What is Kubernetes?
Kubernetes(as known as K8s) is an open source container orchestration
platform that automates many of the manual processes involved in deploying, managing, and scaling containerized applications. It was developed by Google and is now maintained by the Cloud Native Computing Foundation(CNCF).
What can you do with Kubernetes?
The primary advantage of using Kubernetes in your environment, especially if you are optimizing app dev for the cloud, is that it gives you the platform to schedule and run containers on clusters of physical or virtual machines (VMs). More broadly, it helps you fully implement and rely on a container-based infrastructure in production environments. And because Kubernetes is all about automation of operational tasks, you can do many of the same things other application platforms or management systems let you do—but for your containers. With Kubernetes you can:
- Service discovery and load balancing: Kubernetes can expose a container using the DNS name or using their own IP address. If traffic to a container is high, Kubernetes is able to load balance and distribute the network traffic so that the deployment is stable.
- Storage orchestration: Kubernetes allows you to automatically mount a storage system of your choice, such as local storages, public cloud providers, and more.
- Automated rollouts and rollbacks: You can describe the desired state for your deployed containers using Kubernetes, and it can change the actual state to the desired state at a controlled rate. For example, you can automate Kubernetes to create new containers for your deployment, remove existing containers and adopt all their resources to the new container.
- Automatic bin packing: You provide Kubernetes with a cluster of nodes that it can use to run containerized tasks. You tell Kubernetes how much CPU and memory (RAM) each container needs. Kubernetes can fit containers onto your nodes to make the best use of your resources.
- Self-healing: Kubernetes restarts containers that fail, replaces containers, kills containers that don't respond to your user-defined health check, and doesn't advertise them to clients until they are ready to serve.
- Secret and configuration management: Kubernetes lets you store and manage sensitive information, such as passwords, OAuth tokens, and SSH keys. You can deploy and update secrets and application configuration without rebuilding your container images, and without exposing secrets in your stack configuration.
As a newcomer, trying to parse the official documentation can be overwhelming. There are many different pieces that make up the system, and it can be hard to tell which ones are relevant for your use case. This document outlines the various components you need to have a complete and working Kubernetes cluster. And I will attempt to give a high-level overview of the most important components and how they fit together.
The components of a Kubernetes cluster
The Kubernetes control plane is the set of components that manage the Kubernetes cluster. It consists of several key components that work together to orchestrate and manage containerized applications running on the cluster.
The control plane components include:
- kube-apiserver: Exposes a REST interface to all Kubernetes resources. Serves as the front end of the Kubernetes control plane. The main implementation of a Kubernetes API server is kube-apiserver. kube-apiserver is designed to scale horizontally, it scales by deploying more instances. You can run several instances of kube-apiserver and balance traffic between those instances.
- kube-scheduler: Places containers according to resource requirements and metrics. Makes note of Pods with no assigned node, and selects nodes for them to run on.
- kube-controller-manager: The controller manager is responsible for managing the various controllers that run on the cluster. These controllers monitor the state of the cluster and take actions to ensure that the desired state is achieved.
- cloud-controller-manager: The cloud controller manager lets you link your cluster into your cloud provider's API, and separates out the components that interact with that cloud platform from components that only interact with your cluster.
- etcd: etcd is a distributed key-value store that stores the configuration data for the Kubernetes cluster. It is used by the API server to store and retrieve information about the cluster's state, including configuration data, metadata, and runtime information.
The worker node(s) host the Pods that are the components of the application workload. The control plane manages the worker nodes and the Pods in the cluster. In production environments, the control plane usually runs across multiple computers and a cluster usually runs multiple nodes, providing fault-tolerance and high availability.
The worker node components include:
- kubelet: The kubelet is the primary agent that runs on each node in the cluster. It is responsible for managing the pods that are scheduled to run on the node, including starting and stopping containers, monitoring their health, and reporting back to the control plane.
- kube-proxy: The kube-proxy is a network proxy that runs on each node in the cluster. It is responsible for routing traffic to the appropriate containers and services.
- Container runtime: The container runtime is the software that runs the containers on the node. Kubernetes supports several container runtimes, including cri-dockerd, CRI-O, and containerd.
Kubernetes is a powerful platform for managing containerized applications. learning Kubernetes can help you to improve the scalability, portability, resilience, and efficiency of your applications, while also improving your career prospects in the tech industry.