DevOps Selected Interview Questions And Answers

DevOps Selected Interview Questions And Answers

1. Tell me about yourself?

Sure! I have over six years of experience working in DevOps and cloud engineering. I started as a server engineer, and over the years, I moved into DevOps, focusing on cloud and automation. I work with tools like Azure, Jenkins, GitLab CI, Docker, Kubernetes, Terraform, and Ansible to set up and manage infrastructure and automate processes.

In my previous roles, I worked on setting up CI/CD pipelines to speed up deployments, managing cloud resources, and making sure systems stay reliable and secure. In my current organization, we use Azure cloud, and my main job is to automate deployments, monitor system health, and quickly troubleshoot any issues to keep everything running smoothly.

As a DevOps engineer, my responsibilities include building infrastructure that allows developers to release updates faster and more reliably, maintaining system stability, and reducing downtime. I work to make sure that our systems are efficient and support seamless teamwork between development and operations.


2. What is pods in Kubernetes?

A pod is the smallest, most basic deployable unit in Kubernetes, representing a single instance of a running process in the cluster. It can contain one or more tightly coupled containers sharing the same network and storage resources.


3. What is etcd in Kubernetes?

etcd is an open-source distributed key-value store used to hold and manage the critical information that distributed systems need to keep running. It is known as the database for management allocation in K8s. It stores the metadata for Kubernetes.


4. How many services are in Kubernetes?

There are three main types of Services that facilitate networking and communication between components within a cluster and with external clients. Each type of Service is designed for a specific use case:

1) ClusterIP: ClusterIP is the default Service type, exposing the Service on an internal IP accessible only within the cluster. It’s used for internal communication, such as between microservices in the same cluster.

2) NodePort: NodePort Service exposes the Service on the same port across all cluster nodes, mapping an external port (30000-32767) to the Service's internal ClusterIP. This allows external access via <NodeIP>:<NodePort>. It’s typically used for basic external access, such as testing or exposing development applications directly from nodes.

3) LoadBalancer: LoadBalancer Service exposes the Service externally via a cloud provider’s load balancer, giving it a public IP and distributing requests across pod replicas. Commonly used in production for web services needing high availability and load balancing.


5. Which command would you use to create a deployment?

kubectl apply -f deployment-file.yaml


6. What is a replica set in Kubernetes?

A ReplicaSet in Kubernetes is a resource that ensures a specified number of identical pod replicas are running at any given time. It helps achieve high availability and scalability by managing the creation, updating, and deletion of pod replicas. If a pod crashes or is deleted, the ReplicaSet will automatically create a new one to maintain the desired number of replicas.


7. What is a scheduler in kubernetes?

The scheduler is a core component responsible for assigning new or unscheduled pods to nodes in the cluster. It plays a key role in managing the workload across nodes and optimizing resource utilization. The scheduler constantly monitors for new pods that lack a node assignment and determines the best available node for each pod based on several factors.


8. What is the difference between public IP and elastic IP in AWS?

Public IP: Temporary, assigned automatically, changes on instance restart, cannot be reassigned.

Elastic IP: Permanent, assigned manually, remains constant, and can be reassigned across instances.


9. What is the difference between an application load balancer and a Network Load Balancer?

ALB: Layer 7, content-based routing, suitable for web applications and microservices.

NLB: Layer 4, IP-based routing, designed for high-performance applications requiring low latency.


10. What is the difference between Application Gateway and load balancer?

Application Gateway: Layer 7 focuses on application-level traffic management and advanced routing based on request content, ideal for web applications.

Load Balancer: Can operate at Layer 4 or Layer 7, primarily aimed at distributing traffic efficiently across multiple targets for scalability and availability.


11. Is it possible to reduce a EBS volume?

No, it’s not possible, we can increase it but not reduce them


12. Can you establish a Peering connection to a VPC in a different region?

Yes, we can establish a peering connection to a VPC in a different region. It is called inter-region VPC peering connection.


13. Do you need an internet gateway to use peering connections?

Yes, the Internet gateway is needed to use VPC (virtual private cloud peering) connections.


14. What is the difference between soft link and Hard link in Linux?

In Linux, a soft link is a shortcut to a file and can link across filesystems, breaking if the original is deleted. A hard link points directly to the file's data, and the data stays accessible even if the original is deleted. Soft links use ln -s, while hard links use ln.


15. What is the difference between Docker commands: up, run and start?

In Docker, the commands up, run, and start serve different purposes:

docker run: Creates and starts a new container.

docker start: Starts an existing stopped container.

docker-compose up: Starts containers based on a docker-compose.yml file.


16. What is the Terraform State?

In Terraform, state is a file that keeps track of resources managed by Terraform. It stores information about the real-world infrastructure so Terraform can map each resource in your configuration to its actual deployment.

Key Points:

Purpose: The state file records your environment’s current state so Terraform knows what has been created, modified, or deleted.

Location: By default, it's saved as terraform.tfstate in your working directory, but it can also be stored remotely (e.g., in an S3 bucket or Terraform Cloud) for collaboration.

Importance: State enables Terraform to manage updates, deletions, and dependencies accurately and avoid duplicating resources.

Without state, Terraform would not be able to track the resources it manages, making updates and consistency difficult.


17. What are the Providers?

In Terraform, providers are plugins that allow Terraform to interact with various infrastructure platforms (like AWS, Azure, Google Cloud) and services (like Kubernetes, GitHub, Datadog). Providers handle API interactions and define the resources that can be created, managed, or updated within each platform.


18. Can you create a docker file for a java application?
FROM openjdk:11
ADD target/app.jar app.jar
EXPOSE 80
ENTRYPOINT ["java", "-jar", "app.jar"]        

19. Can you create a Kubernetes deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: java-app-deployment
  labels:
    app: java-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: java-app
  template:
    metadata:
      labels:
        app: java-app
    spec:
      containers:
      - name: java-app
        image: my-dockerhub-username/java-app:latest # Replace with your image name
        ports:
        - containerPort: 8080        

20. Can you create a kubernetes service?
apiVersion: v1
kind: Service
metadata:
  name: java-app-service
  labels:
    app: java-app
spec:
  selector:
    app: java-app
  ports:
    - protocol: TCP
      port: 80         # Exposed port on the Service
      targetPort: 8080 # Port the application listens on in the pod
  type: LoadBalancer    # Use NodePort or ClusterIP if not on a cloud provider        

21. A DevOps Engineer manually created infrastructure on AWS, and now there is a requirement to use Terraform to manage it. How would you import these resources in Terraform code?

To import existing AWS resources into Terraform, you can follow these steps:

1. Initialize Terraform

Create a new Terraform project or navigate to your existing project directory

terraform init        

2. Write Resource Configuration

resource "aws_instance" "example" {
  # Attributes will be updated after import
}        

3. Import the Resource

terraform import aws_instance.example i-0abc123def456        

5. Verify the Import

Use the following commands to ensure the resource has been imported successfully:

List resources in the state:

terraform state list        

Show the imported resource details:

terraform state show aws_instance.example        

6. Repeat for Other Resources

Repeat the process for other AWS resources. Ensure each resource has its own configuration block in Terraform.


22. Kubernetes Architecture
23. Internat Gatway Vs NAT Gatway

NAT Gateway: When you need private instances (e.g., application servers or databases) to securely access the internet without exposing them to inbound traffic.

Internet Gateway: When you have public-facing resources (e.g., web servers, APIs) that need to serve requests from the internet.



#DevOps #Cloud #Linux #AWS #Azure #GCP #Docker #Kubernetes #Ansible #Terraform #Jenkins #Python


Great stuff - interview prep is key! 👍 Knowing these core concepts can really set you apart from other candidates and boost your confidence.

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics