Today we will tell you what Kubernetes is, its basic capabilities, and why Docker alone is often not enough to run a serious production environment. If you don't have full knowledge of Docker yet, we recommend our articles on this topic.

What is Kubernetes?

Kubernetes is a container orchestration tool on a large scale regardless of the cloud provider. It allows for automatic deployment and management of application containers. It's a tool that offers much more than Docker alone. You can think of it as docker-compose with additional features allowing you to work on multiple physical machines. It is also worth mentioning that Kubernetes comes in many versions such as:

  • standard, vanilla Kubernetes - it requires additional resources and skills of the administrator resulting from independent installation and deployment. It provides only the basic components required for the cluster to function.
  • managed - cloud service providers such as Azure, AWS, or Google handle the management of the basic infrastructure, including provisioning, scaling, and maintenance of the Kubernetes cluster, allowing users to focus on managing their applications. However, this ties us to a specific cloud provider.
  • distribution - it includes additional tools such as Rancher but is also open-source and allows for self-deployment.
  • lightweight - often used for local deployment, e.g., minikube (deployed on a single node).

 

Why Docker is not enough?


There are several reasons for this, such as:

  • Lack of automatic container respawn in case of failure in Docker - Kubernetes can do this automatically, even in the event of a physical server failure.
  • Docker does not allow for automatic scaling - Kubernetes allows for horizontal scaling of applications, i.e., increasing the number of containers.
  • Kubernetes has built-in load balancing capabilities and the ability to operate on multiple physical machines simultaneously as a cluster.

However, it is worth mentioning that there are also alternatives to container orchestration, such as AWS ECS (not to be confused with EKS mentioned above), which integrates container management with the AWS cloud. Comparing Kubernetes to AWS ECS is not entirely accurate because ECS is based on Docker Engine, and its integration with other AWS services gives it additional capabilities such as container reset, autoscaling, and load balancing. Additionally, ECS allows provisioning of additional resources from AWS, which is not available from Kubernetes. However, the drawback of this solution is excessive attachment to the cloud provider because ECS YAML configurations only work within AWS, whereas Kubernetes configurations work independently of the provider (provided the provider offers the appropriate Kubernetes version within its infrastructure).

 

Basic Concepts

Now that we have some intuition about what Kubernetes is and how it differs from Docker, we can move on to discussing the basic concepts and classifications used when talking about K8s.

Figure 1 - Kubernetes Cluster Components, source: medium.com

 

The basic division that can be distinguished in the case of Kubernetes is:

  • Control plane - responsible for managing the cluster and making appropriate decisions, such as scheduling or maintaining the desired cluster state. It consists of the so-called master nodes, which are the cluster nodes responsible for management.
  • Data plane - responsible for processing data in the cluster using worker nodes, which are the nodes that perform computations. It is where containerized applications run, performing computational operations.

Sometimes on the Internet, you can come across the term that the control plane is like the brain, and the data plane is like the rest of the body, and this seems to be a fairly accurate comparison. These layers consist of various components that can be observed in the above diagram. So, a Kubernetes cluster consists of a control layer composed of master nodes, inside which there are various processes and services for management, and a data layer (data plane), which usually consists of a larger number of worker nodes inside which the appropriate components are located.

The control plane consists of:

  • API server - a component with which other components interact to manage the cluster. It is a REST API.
  • etcd database - a key-value database responsible for storing all data about the cluster, such as metadata, state data, components, and resources.
  • Controller manager - responsible for managing the cluster state and consists of several elements such as node controller or replication controller. It ensures that the cluster is in a consistent state with the configured settings.
  • Scheduler - responsible for assigning the appropriate pods to the appropriate worker nodes. It also ensures resource constraints and requirements for running a given pod.

The data layer includes elements such as:

  • Kubelet - an agent operating on the worker node responsible for managing the node as specified by the master node.
  • Pod - the smallest, atomic unit in Kubernetes containing a container. It is an abstract container usually containing a single container, but with the ability to place several of them there.
  • Proxy - an element responsible for network traffic to a specific worker node, load balancing, routing to the appropriate applications running on pods.
  • Container runtime - a component responsible for managing the lifecycle of containers in Kubernetes.

 

Responsibilities of Kubernetes

It is also worth mentioning what Kubernetes is responsible for and what tasks the administrator/developer handling it is responsible for. Creating a cluster, launching appropriate services, or appropriate resources such as cloud storage that Kubernetes will use is the responsibility of the developer. However, managing pods, scaling, and striving to achieve the appropriate state defined in the configuration is the task for Kubernetes.

Summary
That's all we wanted to tell you as an introduction. Be sure to check out our articles on Docker best practices and Docker itself if you want to build a solid foundation for understanding Kubernetes. See you next week!

 

Sources: