Devops Interview Questions asked in Capgemini for 3-5 years experience
Table of Contents
- 1. Explain how Linux mechanisms work, especially when the system starts.
- 2. What happens when you run a container in Kubernetes?
- 3. What is the difference between git merge and git rebase?
- 4. Why and when would you use the git cherry-pick command?
- 5. Key differences between Jenkins Declarative Pipeline and Scripted Pipeline?
- 6. What is DNS and how does it work?
- 7. Explain how routes work in a network environment.
- 8. How do you implement network policies in Kubernetes?
- 9. How do Prometheus and Grafana interact? What is the source of data for Prometheus?
- 10. Which database did you use in your recent project, and why?
- 11. What is an SQL index, and how does it work?
- 12. Situation: faced challenge working with a non-technical team.
- 13. Would you describe yourself as a communicator or a problem-solver?
- 14. Tell me about a situation where you took on a leadership role.
- 15. What values do you consider important when working with a team?
- 16. What are your hobbies outside of technical work?
- 17. Why did you choose Docker in your recent project?
1. Explain how Linux mechanisms work, especially when the system starts.
- When Linux boots:
- BIOS/UEFI loads the bootloader (e.g., GRUB).
- Bootloader loads Linux kernel into memory.
- Kernel initializes hardware, mounts the root filesystem.
init
orsystemd
starts โ spawns system services.- User processes start (login, daemons, shells).
- Key mechanisms: kernel space vs user space, init system, process scheduling, system calls.
2. What happens when you run a container in Kubernetes?
- Steps:
- You create a Pod manifest.
- API Server stores it in etcd (cluster DB).
- Scheduler assigns the Pod to a node.
- Kubelet on that node pulls the container image from registry.
- Container runtime (containerd/Docker) runs the container.
- CNI plugin sets up networking.
- Pod is now running; Kubelet reports status back to API server.
3. What is the difference between git merge and git rebase?
- Merge: Combines branches, preserves history, creates a merge commit.
- Rebase: Moves commits on top of another branch, linear history, no merge commit.
โ Use merge when you want to preserve full history.
โ Use rebase when you want a clean, linear commit history.
4. Why and when would you use the git cherry-pick command?
- Cherry-pick applies a single commit from one branch to another.
- Useful when:
- You need a bug fix from
dev
branch inprod
without merging everything. - Selectively applying hotfixes.
- You need a bug fix from
5. Key differences between Jenkins Declarative Pipeline and Scripted Pipeline?
- Declarative Pipeline:
- Uses
pipeline {}
syntax. - Easier, opinionated, error handling built-in.
- Example:
pipeline { stages { stage("Build") { steps { echo "Building..." } } } }
- Uses
- Scripted Pipeline:
- Uses
node {}
syntax, Groovy-based. - More flexible, complex logic possible.
- Example:
node { stage("Build") { echo "Building..." } }
- Uses
6. What is DNS and how does it work?
- DNS (Domain Name System) resolves domain names into IP addresses.
- Workflow:
- User requests
google.com
. - Query goes to recursive resolver.
- Resolver queries root โ TLD โ authoritative DNS.
- IP returned to client.
- User requests
- Uses UDP/TCP port 53.
7. Explain how routes work in a network environment.
- A route defines how packets travel between networks.
- Routing table: tells system which next hop to use for a destination IP.
- Example:
0.0.0.0/0 via 192.168.1.1
โ default route.
- Types: static routes, dynamic routing protocols (OSPF, BGP).
8. How do you implement network policies in Kubernetes?
- NetworkPolicies control pod-to-pod and pod-to-external communication.
- Define in YAML:
apiVersion: networking.k8s.io/v1 kind: NetworkPolicy spec: podSelector: matchLabels: role: db ingress: - from: - podSelector: matchLabels: role: api
- Requires CNI plugin that supports policies (Calico, Cilium).
9. How do Prometheus and Grafana interact? What is the source of data for Prometheus?
- Prometheus: Time-series database, scrapes metrics via HTTP (e.g.,
/metrics
). - Grafana: Visualization tool โ queries Prometheus as a data source.
- Prometheus data sources: exporters (Node Exporter, cAdvisor, Kube State Metrics), app endpoints.
10. Which database did you use in your recent project, and why?
- Example answer:
- โWe used PostgreSQL because it supports ACID compliance, complex queries, and strong community support. It was ideal for handling transactional data at scale.โ
- Adapt based on your actual project.
11. What is an SQL index, and how does it work?
- An index improves query performance by storing a lookup structure (like a B-tree) for faster searches.
- Instead of scanning full table, DB engine uses index to find rows quickly.
- Trade-off: Faster reads, but slower writes (extra index updates).
12. Situation: faced challenge working with a non-technical team.
- Example:
- Marketing team requested real-time data dashboards. They lacked technical understanding.
- I simplified concepts, used visual demos, and iterated based on feedback.
- Outcome: Delivered a self-service Grafana dashboard they could use easily.
13. Would you describe yourself as a communicator or a problem-solver?
- Balanced answer:
- โI see myself as a problem-solver first, but I believe communication is critical to solving problems effectively in a team.โ
14. Tell me about a situation where you took on a leadership role.
- Example:
- During a production outage, I coordinated between Dev, Ops, and Network teams.
- Assigned roles, ensured clear communication, led root-cause analysis.
- Restored service within SLA and documented post-mortem.
15. What values do you consider important when working with a team?
- Collaboration, trust, accountability, respect, and continuous learning.
- Stress ownership and knowledge sharing.
16. What are your hobbies outside of technical work?
- Keep it professional + personal:
- โI enjoy reading about emerging technologies, contributing to open-source, and outside work I play cricket and practice photography.โ
17. Why did you choose Docker in your recent project?
- โWe chose Docker because it provides lightweight, portable, and consistent environments across dev, test, and prod. It reduced environment drift, accelerated CI/CD, and improved scalability in Kubernetes.โ
EC2 Scenario based questions to challenge your AWS & DevOps skills :
- Your EC2 instance is running but you canโt connect via SSH. What troubleshooting steps will you take? Check Security Group inbound rules (port 22 open to your IP).
Verify Network ACLs (NACLs not blocking inbound/outbound).
Confirm instanceโs Public IP / Elastic IP.
Validate Key Pair and correct permissions on .pem.
Ensure SSM Agent is installed (Session Manager can help).
Check system logs on the console for OS-level issues. - You terminated an EC2 instance by mistake. How can you prevent this in the future?
Enable Termination Protection in EC2 settings.
Use IAM permissions to restrict TerminateInstances.
Tag critical instances and set resource policies.
- Your EC2 instance needs to access an S3 bucket securely. Whatโs the best way to configure this?
Best practice: Attach an IAM Role with least privilege policy to the EC2 instance.
Avoid hardcoding credentials or using access keys.
- An application hosted on EC2 needs to be highly available across AZs. How will you achieve it?
Use an Auto Scaling Group (ASG) spanning multiple AZs.
Place EC2 instances behind an Elastic Load Balancer (ALB/NLB).
Store shared data in EFS, S3, or RDS Multi-AZ.
- You need to run scheduled scripts on EC2 daily. What approaches are available?
Use cron jobs inside EC2 for OS-level scheduling.
Or AWS Systems Manager Automation Documents.
Or trigger scripts from EventBridge / CloudWatch Events to call SSM Run Command.
- How will you enable auto-scaling for EC2 based on CPU utilization?
Create an Auto Scaling Group with a Launch Template.
Define a CloudWatch alarm on CPUUtilization.
Attach a scaling policy (step or target tracking).
- Youโre seeing high latency between EC2 and RDS in the same region. What might be wrong?
Verify EC2 and RDS are in the same VPC and AZ.
Check security groups and subnet routing.
Ensure DNS resolution is correct (use private endpoint).
Check instance type & network performance (Enhanced Networking for EC2).
- You need to move an EC2 instance to another region. What are your options?
Create an AMI of the instance and copy AMI to the target region, then launch.
Or take an EBS snapshot and copy to the other region, then create a volume.
For full migration, use AWS MGN or third-party tools. - Your EC2 disk space keeps filling up. How do you investigate and fix this?
SSH into the instance, run df -h and du -sh /* to find large directories.
Rotate or offload logs to CloudWatch Logs or S3.
Expand EBS volume size or use EBS Elastic Volumes.
Automate cleanup (logrotate, tmp cleaner).
- You have to reduce EC2 costs without affecting performance. Which AWS features can you use?
Use Right Sizing (smaller instance types).
Spot Instances or Savings Plans for predictable workloads.
Turn off non-production EC2 during off-hours (use Instance Scheduler).
Consider Graviton-based instances for better price/performance.