DEV Community

Aditya Yadav
Aditya Yadav

Posted on

Kubernetes Interview Questions

1. What is Kubernetes and how does it work?

Kubernetes is an open-source platform for automating deployment, scaling, and management of containerized applications. It uses a declarative configuration to manage containers, as well as provide features such as self-healing, horizontal scaling, and service discovery.

2. Can you explain the architecture of a Kubernetes cluster?

A Kubernetes cluster consists of a set of worker nodes that run containerized applications, and a control plane that manages the state of the cluster and the applications. The control plane is composed of the API server, the controller manager, and the etcd database. The worker nodes communicate with the control plane to receive instructions and report the status of containers.

3. What are Pods, Replication Controllers, and Services in Kubernetes?

Pods are the smallest deployable units in Kubernetes and can contain one or more containers. Replication Controllers ensure that a specified number of pods are running at all times. Services provide stable network identities and load balancing for pods.

4. How does Kubernetes handle network communication between Pods?

Kubernetes uses a network overlay, such as Flannel or Calico, to provide communication between pods. Pods are assigned unique IP addresses, and services can be used to load balance network traffic to pods.

5. Can you explain the role of etcd in Kubernetes?

etcd is a distributed key-value store that is used to store the configuration data for a Kubernetes cluster. It serves as the source of truth for the cluster state and is used by the API server to persist the state of objects such as pods and services.

6. How does Kubernetes handle scaling of applications?

Kubernetes provides horizontal scaling by allowing users to increase or decrease the number of replicas of a given deployment. The Replication Controller or Deployment controller will then ensure that the desired number of replicas are running.

7. What is a ConfigMap in Kubernetes and how is it used?

A ConfigMap is a way to store configuration data as key-value pairs outside of a container image. It can be used to store configuration data for an application and can be mounted as a file or environment variables in a pod.

8. Can you describe the process of rolling updates in Kubernetes?

Rolling updates allow a user to update an application without any downtime by incrementally updating replicas in a deployment. The Replication Controller or Deployment controller updates one replica at a time, allowing the new version to be tested before the entire deployment is updated.

9. What are some common security concerns in Kubernetes and how are they addressed?

Some common security concerns in Kubernetes include network security, access control, and secrets management. Network security can be addressed using network policies and encryption of etcd data. Access control can be managed using Role-Based Access Control (RBAC) and secrets can be managed using secrets engines, such as Hashicorp Vault.

10. Can you explain the difference between a deployment and a stateful set in Kubernetes?

A Deployment is used to manage the scaling and updates of stateless applications, while a StatefulSet is used for stateful applications that require stable network identities and persistent storage. StatefulSets provide unique network identities for pods and maintain the order of pods during updates and rollbacks.

Top comments (0)