DevOps
Interview Questions &
Answers
PART - 2
Page | 1
@cyberdefentech training@[Link] +91 8448046612
26. What is Infrastructure as Code?
Infrastructure as Code (IaC) is the practice of managing and provisioning infrastructure through machine-
readable definition files rather than physical hardware configuration or interactive configuration tools.
Benefits of IaC:
o Version Control
o Reproducibility
o Automation
o Documentation
o Consistency
o Scalability
27. What is Terraform?
Terraform is an open-source IaC software tool that enables you to safely and predictably create, change,
and improve infrastructure. It codifies cloud APIs into declarative configuration files.
Example of a simple Terraform configuration:
provider "aws" {
region = "us-west-2"
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "[Link]"
tags = {
Name = "example-instance"
Page | 2
@cyberdefentech training@[Link] +91 8448046612
28. What is Ansible?
Ansible is an open-source automation tool that automates software provisioning, configuration
management, and application deployment. It uses YAML syntax for expressing automation jobs.
Example of an Ansible playbook:
---
- name: Install and configure web server
hosts: webservers
become: yes
tasks:
- name: Install nginx
apt:
name: nginx
state: present
- name: Start nginx service
service:
name: nginx
state: started
Monitoring and Logging
31. What is monitoring in DevOps?
Monitoring in DevOps is the practice of collecting and analyzing data about the performance and stability of
services and infrastructure to improve the system's reliability. Key aspects include:
i. Infrastructure Monitoring:
▪ Server health
▪ Network performance
▪ Resource utilization
Page | 3
@cyberdefentech training@[Link] +91 8448046612
ii. Application Monitoring:
▪ Response times
▪ Error rates
▪ Request rates
iii. User Experience Monitoring:
▪ Page load times
▪ User interactions
▪ Conversion rates
32. What is ELK Stack?
ELK Stack is a collection of three open-source products:
i. Elasticsearch: A search and analytics engine
ii. Logstash: A server-side data processing pipeline
iii. Kibana: A visualization tool for Elasticsearch data
Common use cases:
o Log aggregation
o Security analytics
o Application performance monitoring
o Website search
o Business analytics
33. What is Prometheus?
Prometheus is an open-source systems monitoring and alerting toolkit. Key features include:
i. Time series database
ii. Flexible query language (PromQL)
iii. Pull-based metrics collection
iv. Alert management
v. Visualization capabilities
Page | 4
@cyberdefentech training@[Link] +91 8448046612
Example of Prometheus configuration:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
34. What is Grafana?
Grafana is an open-source analytics and monitoring solution that allows you to query, visualize, and alert on
your metrics no matter where they are stored. Key features include:
i. Data source integration
ii. Dashboard creation
iii. Alerting
iv. Visualization
v. User interface
35. Explain the difference between monitoring and logging
Monitoring and logging are two different practices in DevOps:
i. Monitoring:
▪ Focuses on collecting and analyzing data about the performance and stability of
services and infrastructure to improve the system's reliability.
▪ Key aspects include:
Page | 5
@cyberdefentech training@[Link] +91 8448046612
▪ Infrastructure Monitoring
▪ Application Monitoring
▪ User Experience Monitoring
ii. Logging:
▪ Focuses on collecting and analyzing log data to help diagnose and troubleshoot
issues.
▪ Key aspects include:
▪ Log aggregation
▪ Security analytics
▪ Application performance monitoring
▪ Website search
▪ Business analytics
Security and Compliance
36. What is DevSecOps?
DevSecOps is the practice of integrating security practices within the DevOps process. It creates a 'security
as code' culture with ongoing, flexible collaboration between release engineers and security teams.
Key principles include:
o Security automation
o Early security testing
o Continuous security monitoring
o Security as part of CI/CD pipeline
o Rapid security feedback
37. What is Infrastructure Security?
Infrastructure Security involves securing all infrastructure components including:
[Link] Security:
▪ Firewalls
▪ VPNs
Page | 6
@cyberdefentech training@[Link] +91 8448046612
▪ Network segmentation
▪ DDoS protection
[Link] Security:
▪ Identity and Access Management (IAM)
▪ Encryption
▪ Security groups
▪ Network ACLs
[Link] Security:
▪ OS hardening
▪ Patch management
▪ Antivirus
▪ Host-based firewalls
Linux Administration
41. What are the basic Linux commands every DevOps engineer should know?
Essential Linux commands include:
i. File Operations:
ls # List files and directories
cd # Change directory
pwd # Print working directory
cp # Copy files
mv # Move/rename files
rm # Remove files
mkdir # Create directory
ii. System Information:
top # Show processes
df # Show disk usage
Page | 7
@cyberdefentech training@[Link] +91 8448046612
free # Show memory usage
ps # Show process status
iii. Text Processing:
grep # Search text
sed # Stream editor
awk # Text processing
cat # View file contents
Version Control
46. What is Git?
Git is a distributed version control system that tracks changes in source code during software development.
It's designed for coordinating work among programmers, but it can be used to track changes in any set of
files.
Key concepts include:
o Repository
o Commit
o Branch
o Merge
o Pull Request
o Clone
o Push/Pull
47. What is Git Branching Strategy?
A Git branching strategy is a convention or set of rules that specify how and when branches should be
created and merged. Common strategies include:
[Link] Flow:
▪ Main branches: master, develop
▪ Supporting branches: feature, release, hotfix
[Link]-Based Development:
Page | 8
@cyberdefentech training@[Link] +91 8448046612
▪ Single main branch (trunk)
▪ Short-lived feature branches
▪ Frequent integration
Example of creating a feature branch:
# Create and switch to a new feature branch
git checkout -b feature/new-feature
# Make changes and commit
git add .
git commit -m "Add new feature"
# Push to remote
git push origin feature/new-feature
Configuration Management
51. What is Configuration Management?
Configuration Management is the process of maintaining systems, such as computer systems and servers, in
a desired state. It's a way to make sure that a system performs as it's supposed to as changes are made over
time.
Key aspects include:
o System configuration
o Application configuration
o Dependencies management
o Version control
o Compliance and security
52. What is Puppet?
Puppet is a configuration management tool that helps you automate the provisioning and management of
your infrastructure. It uses a declarative language to describe system configurations.
Page | 9
@cyberdefentech training@[Link] +91 8448046612
Example of a Puppet manifest:
class apache {
package { 'apache2':
ensure => installed,
service { 'apache2':
ensure => running,
enable => true,
require => Package['apache2'],
file { '/var/www/html/[Link]':
ensure => file,
content => 'Hello, World!',
require => Package['apache2'],
Scalability and High Availability
56. What is Scalability in DevOps?
Scalability is the capability of a system to handle a growing amount of work by adding resources to the
system. There are two types of scaling:
i. Vertical Scaling (Scale Up):
▪ Adding more power to existing resources
▪ Example: Upgrading CPU/RAM
ii. Horizontal Scaling (Scale Out):
Page | 10
@cyberdefentech training@[Link] +91 8448046612
▪ Adding more resources
▪ Example: Adding more servers
57. What is High Availability?
High Availability (HA) is a characteristic of a system that aims to ensure an agreed level of operational
performance, usually uptime, for a higher than normal period.
Key components:
i. Redundancy:
▪ Multiple instances
▪ No single point of failure
ii. Monitoring:
▪ Health checks
▪ Automated failover
iii. Load Balancing:
▪ Traffic distribution
▪ Resource optimization
58. What is Load Balancing?
Load Balancing is the process of distributing network traffic across multiple servers to ensure no single
server bears too much demand.
Common Load Balancing algorithms:
i. Round Robin
ii. Least Connections
iii. IP Hash
iv. Weighted Round Robin
v. Resource-Based
Example of Nginx Load Balancer configuration:
http {
upstream backend {
Page | 11
@cyberdefentech training@[Link] +91 8448046612
server [Link];
server [Link];
server [Link];
server {
listen 80;
location / {
proxy_pass [Link]
59. What is Auto Scaling?
Auto Scaling is a feature that automatically adjusts the number of compute resources based on the current
demand.
Key concepts:
i. Scaling Policies:
▪ Target tracking
▪ Step scaling
▪ Simple scaling
ii. Metrics:
▪ CPU utilization
▪ Memory usage
▪ Request count
▪ Custom metrics
Example of AWS Auto Scaling configuration:
AutoScalingGroup:
Page | 12
@cyberdefentech training@[Link] +91 8448046612
MinSize: 1
MaxSize: 10
DesiredCapacity: 2
HealthCheckType: ELB
HealthCheckGracePeriod: 300
LaunchTemplate:
LaunchTemplateId: !Ref LaunchTemplate
Version: !GetAtt [Link]
Page | 13
@cyberdefentech training@[Link] +91 8448046612