- What is Kubernetes and explain its architecture?
Kubernetes is an open-source container orchestration tool for automating deployment, scaling, and management of containerized applications.
Kubernetes cluster have 2 components
- Kubernetes Master (Control Plane) 2- Kubernetes Node
Master have 4 major components:-
- Api Server: - Use to communicate between all objects in Kubernetes cluster
- Scheduler:- Define the best fit Node for pod deployment
- Controller Manager:- Heath check in your cluster, Desired number of pod running
- ETCD: - Configuration data and deployment state info live in ETCD in key value pair
Node have 3 components:-
- Docker:- container engine to run containers in the form of pod
- Kubelet: - It is responsible to communicate node to master components and it receive instruction from master and perform action on node
Kubeproxy:- this is a proxy service, The kube-proxy handles network communications inside or outside of your cluster
2. What are the features of Kubernetes?
Kubernetes provides features like: -
- Automated Scheduling
- Self-Healing Capabilities
- Automated rollouts & rollback
- Horizontal Scaling & Load Balancing
- Offers environment consistency for development, testing, and production
- Infrastructure is loosely coupled to each component can act as a separate unit
- Provides a higher density of resource utilization
Offers enterprise-ready features
3. What is container orchestration and why we need it?
Container orchestration automates the deployment, management, scaling, and networking of containers.
Suppose we have 5-6 microservices for a single application performing various tasks, and all these microservices are put inside containers. Now, to make sure that these containers communicate with each other we need container orchestration. And container orchestration provides automated deployment, auto scaling, automated roll back & roll out feature.
4. How can you deploy pod through Kubernetes & Explain the app deployment strategy in Kubernetes?
Through the Kubernetes we can deploy pods with replication controller, replica set and deployments etc.
Deployment Strategies: -
- Rolling Deployment: - The rolling deployment is the standard default deployment in Kubernetes. It works by slowly, one by one, replacing pods of the previous version of your application with pods of the new version without any cluster downtime.
- Recreate deployment: - In this type of very simple deployment, all of the old pods are killed at once and get replaced all at once with the new ones.
- Blue/ Green or Red / Black deployments:- In this deployment, the old version of the application (green) and the new version (blue) get deployed at the same time. Release a new version alongside the old version then switch traffic
- Canary deployment:- Release a new version to a subset of users, then proceed to a full rollout
- Dark deployments or A/B Deployments: - As a canary release, the subset it’s defined by specific conditions.
5. How can you expose your application to the world through the Kubernetes?
We can expose out application via service in Kubernetes.
There are different types of service:-
- ClusterIP: - This default type exposes the service on a cluster-internal IP. We can reach the service only from within the cluster.
- NodePort: - This type of service exposes the service on each node’s IP at a static port.
- LoadBalancer: - This service type exposes the service externally using the load balancer. The external load balancer routes to NodePort and ClusterIP services, which are created automatically.
ExternalName: - This type maps the service to the contents of the ExternalName field (e.g., test.example.com). It does this by returning a value for the CNAME record.
6. Explain volume management in Kubernetes?
Container storage are ephemeral and that’s the reason data not persistent in container. So, Kubernetes use volume to store persistent data. A Volume is essentially a directory backed by a storage medium. Kubernetes supports different types of volumes: -
- Empty directory
- Host path
- Ceph etc…..
7. Difference between Kubernetes v/s Docker Swarm?
Docker Swarm Kubernetes
No auto scaling Auto Scaling
Good Community Great active community
Doesn’t have much experience in production Deploy at scale in production
Limited to docker’s api can overcome constraints of docker & it’s API
Preferred for simple architecture preferred for complex architecture
No GUI GUI in the Kubernetes dashboard
Rolling update & roll back Automated rolling update & roll back
8. How can you do monitoring on your Kubernetes cluster?
Like most platform, Kubernetes support many tools for monitoring in Kubernetes cluster. We can use those tools to monitor our cluster.
- cadvisor and heapster
- Kubernetes metrics server
- Kubernetes Dashboard
- Kubernetes kube-state-metrics
- Kubernetes liveness and readiness probes
- Prometheus for Kubernetes monitoring
- Sysdig Monitor for Prometheus monitoring scale
9. Explain the ETCD in Kubernetes?
ETCD is persistent informatics database of Kubernetes cluster. It store all the configuration, state of our cluster information in key value pair.
ETCD can be single or it can be on multiple node like cluster.
So ETCD is a distributed reliable key-value store, that is simple, secure and fast.
10. Explain the Load Balancing in Kubernetes?
Load balancing is the process of distributing network traffic among multiple backend services, and is a critical strategy for maximizing scalability and availability.
So, Kubernetes have variety of choices for load balancing external traffic to pods, each with different trade-offs.
Some Load balancing strategies: -
- L4 Round Robin Load Balancing with kube-proxy
- L7 Round Robin Load Balancing
- Ring hash
Kubernetes Training and Certification program helps to minimize all the hurdles in getting a good job in this field. Well the blog is written to help the candidates to crack their interview.