Top 10 Basic Interview Questions of Kubernetes
Q1. What is the difference between Docker and Kubernetes?
Docker is a container platform whereas Kubernetes is a container orchestration environment that offers capabilities like Auto Healing, Auto-Scaling, Clustering, and Enterprise level support like Load Balancing.
As you know containers are ephemeral that is containers can go down for multiple reasons and if containers go down then applications also go down, so avoid that you can move to a container orchestration solution like Auto Healing, or Auto-Scaling.
Kubernetes is a cluster itself like in production you can join or combine multiple virtual machines and create a Kubernetes cluster so that even if one of your nodes, as Kubernetes is a cluster then it will immediately move the pod from a specific node to a different node.
Q2. What are the main components of Kubernetes Architecture?
On a broad level, you can divide the Kubernetes components into two parts
Control Plane:-
API SERVER
SCHEDULER
Controller Manager
Cloud Controller Manager(C-CM)
ETCD
Data Plane:-
Kubelet
Kube-Proxy
Container Runtime
Q3. What is the difference between Docker Swarm and Kubernetes
Docker Swarm is a Docker-based solution whereas Kubernetes is better suited for large organizations as it offers more scalability, networking capabilities like policies, and huge third-party ecosystem support.
Q4. What is the difference between a Docker container and a Kubernetes Pod?
A pod in Kubernetes is a runtime specification of a container in docker. A pod provides a more declarative way of defining using YAML and you can run more than one container in a pod.
A pod is nothing but a runtime specification of a container.
Q5. What is a namespace in Kubernetes?
In Kubernetes namespace is a logical isolation of resources, network policies, rbac, and everything. For example, two projects are using the same k8s cluster. One project can use ns1 and the other project can use ns2 without any overlap and authentication problem.
Q6. What is the role of Kube Proxy?
Kube-proxy works by maintaining a set of network rules on each node in the cluster, which are updated dynamically as services are added or removed. When a client sends a request to a service, the request is intercepted by kube-proxy on the node where it was received. Kube-proxy then looks up the destination endpoint for the service and routes the request accordingly.
Kube-proxy is an essential component of a Kubernetes cluster, as it ensures that services can communicate with each other.
Q7. What are the different types of services within Kubernetes?
There are three different types of services that a user can create.
Cluster IP Mode
Node Port Mode
Load Balancer Mode
Q8. What is the difference between Node Port and Load Balancer type service?
When a service is created with a Node Port type, the kube-proxy updates the IPTables with the Node IP address and port that is chosen in the services configuration to access the pods.
Whereas if you create a service as type Load Balancer, the cloud control manager creates an external load balancer IP using the underlying cloud provider logic in the C-CM. Users can access services using the external IP.
Q9. What is the role of Kubelet?
Kubelet manages the containers that are scheduled to run on that node. It ensures that the containers are running and healthy and that the resources they need are available.
Kubelet communicates with the Kubernetes API server to get information about the containers that should be running on the node, and then starts and stops the containers as needed to maintain the desired state. It also monitors the containers to ensure that they are running correctly and restart them if necessary.
Q10. What are day-to-day activities on Kubernetes?
As part of the DevOps engineer role we manage the Kubernetes cluster for our organization and we also ensure that the applications are deployed onto the Kubernetes cluster and there are no issues with the application, so we have setup monitoring on our Kubernetes cluster we ensure that whenever there are bugs on the Kubernetes cluster for example developer are not able to troubleshoot some issue with respect to pods developer are not able to troubleshoot with respect to services, they are no able route the traffic inside the Kubernetes cluster, so in such cases as subject matter expertise on the Kubernetes cluster we come into picture and we solve there problem but apart from that we also do lot of maintenance activities for example, we have three Master nodes and 10 worker node so we do some continuous maintenance activities on this worker nodes like upgrading the version of this worker nodes or installing some default mandatory packages ensuring that these worker nodes are not exposed to security vulnerabilities.