Kubernetes Architecture

Photo of author

By admin

Kubernetes is an open-source container platform designed to deploy and run distributed applications and services across the clusters of hosts. Kubernetes offers many services such as container runtime, container-centric infrastructure, container orchestration, load balancing, and service discovery.

However, it is not just a container orchestrator as it also can be used as an operating system to run cloud-native applications just like desktop applications run on Windows, Linux, or macOS. Although Kubernetes can run all major workloads like monoliths, microservices, stateless or stateful applications, services, batch jobs, and much more, users generally run the microservices on the platform. 

Kubernetes is known for its flexibility and extensibility because it allows the users to utilize its features a-la-carte or employ their own solutions. It also allows the users to incorporate Kubernetes into their environment and add more functions. 

You may have been aware of these capabilities of Kubernetes but what you may not understand is the components of Kubernetes and how they interact with each other. If that is the case, you will find all the essential information to understand the Kubernetes architecture in this article.

So, without further ado, let’s get started.

Principles of Kubernetes Architecture Design

There are three principles on which the Kubernetes architecture is based, and they are mentioned below:

  1. Secure: The Kubernetes cluster has to adhere to the latest and best security practices.
  2. Easy to use: It is extremely user-friendly and can be used by anyone with just a few easy commands.
  3. Extendable: It can be used with any provider and can be customized from a configuration file.

Kubernetes Cluster

A working Kubernetes deployment is known as a cluster, and a Kubernetes cluster can be divided into two parts: a control plane (master) and a group of cluster nodes (Kubelets). Each of these nodes has its own Linux environment and can be a virtual machine or a physical machine. These nodes are responsible for running pods that are made up of containers. There is also a distributed storage system that keeps the state of the cluster consistent and stable.

  • Working of Control Plane

The control panel is the component of Kubernetes responsible for maintaining a record of all Kubernetes objects. Its function is to keep a constant tab on the states of objects and respond to any changes in the Kubernetes cluster. It is also responsible for matching the system objects’ current status with the desired state of the system. 

However, the control plane consists of three major components. They are Kube-API server, Kube-scheduler, and Kube-controller-manager; all of them depend on a single master node. They are also capable of replicating across more than one master node to increase availability. 

The lifecycle orchestration is supported by APIs that are provided by API servers. The lifecycle orchestration includes scaling, updates, and other such activities for different types of applications. The API Server is also the gateway to the cluster, which means that clients must be able to access the API Server from outside the cluster. Clients can be authenticated via the API Server, and it also acts as a proxy or tunnel for the clients to get to the nodes, pods, and services.

Metadata is contained in most resources that can include labels, annotations, desired state, and the current status. It is the job of the controllers to drive the scrutinized state towards the wished state. 

The various controllers drive the state for nodes, endpoints (services and pods), replication (autoscaling), tokens (namespaces), and service accounts. The Controller Manager is a daemon that is designed to run the core control loops, watch the cluster status, and make required changes so that the current status can be driven to the desired state. 

The Cloud Controller Manager performs integration into each public cloud so that it could acquire optimal support of availability zones, storage services, VM instances, and network services for routing, load balancing, and DNS. The Scheduler manages the containers’ schedules across all the nodes in the cluster and takes different constraints into account, for example, resource limitations or guarantees. 

  • Cluster Nodes

Machines that run containers are called cluster nodes, and the master nodes are responsible for managing them. The primary controller in Kubernetes is the Kubelet, and it drives the container execution layer like Docker. 

Pods

The smallest and simplest unit of the Kubernetes object model, the pod, is also an essential concept as the developers interact mainly with pods. The logical construct of pods represents only one application, which is capable of having more than one container along with the storage volumes. 

Apart from this, pods also have another function, which is hosting vertically-integrated application stacks such as a WordPress LAMP (Linux, Apache, MySQL, PHP) application. 

However, pods do not exist forever but actually have a limited lifespan and eventually die when you scale down or upgrade to a new version. Pods are capable of horizontal autoscaling, which means to grow or shrink the number of occurrences, and they are also able to perform canary deployments and rolling updates.

Types of Pods

There are different types of pods in the Kubernetes architecture and they are discussed below:

  • ReplicaSet: This is a relatively simple type of pod, and it is also the default type. Its job is to make sure that the specified number of pods can run properly. 
  • Deployment: Deployment offers declarative upgradation to ReplicaSets and Pods. Some typical use case of Deployments are as follows: 
    • creating deployment to rollout a ReplicaSet
    • declaring the new state of the Pods
    • rolling back to a previous deployment revision
  • Daemon set: This type of pod ensures that each node will run an instance of a pod and is used for various cluster services such as log forwarding and health monitoring.
  • StatefulSet: This is designed to manage pods that are supposed to maintain their state or continue existing
  • Job and CronJob: Job and CronJob type pods are designed to run temporary jobs as a one-off or according to a schedule. 

Kubelet

As we know that the primary and most important controller in the Kubernetes system is called kubelet. Kubelet is contained in each compute node and it is a light-weight application communicating with the control plane. The function of the kubelet is to make sure that the containers are running in a pod, and when the control plane requires some task in a node, it is the kubelet that performs the task. 

Kube-proxy

Each computed node in the Kubernetes architecture also contains Kube-proxy. Kube-proxy is a network proxy that facilitates the networking services in Kubernetes. It manages the network communications both inside and outside of the cluster by either relying on the OS’s packet filtering layer or by forwarding the traffic itself. 

Other components of a Kubernetes architecture

Here we’ve provided information about the other components of Kubernetes, have a look. 

Persistent storage

Kubernetes not only manages the containers running applications but is also capable of managing the data of the application, which is attached to a cluster. Through Kubernetes, users can request storage resources without knowing about the fundamental infrastructure. However, persistent volumes are only specific to a cluster and not to a pod, which is why they can outlive the lifespan of a pod. 

Container registry

A container registry is a place where the container images are stored that are used by the Kubernetes. This registry can either be a third-party registry or a registry configured by the user. 

Underlying infrastructure

Kubernetes allows its users to run it wherever they want because one of the biggest advantages of Kubernetes is that it can work on different kinds of infrastructure. It can run on physical metal servers, virtual machines, public cloud servers, private cloud servers, as well as hybrid cloud environments.

Kubernetes is Complex but Flexible!

The overview of Kubernetes architecture presented is only a superficial picture of the entire thing. You can fully understand these components when you dive deep into how these components engage with each other, with external resources and infrastructure. After this, you will know the hurdles of the configuration of a Kubernetes cluster and securing it.

Kubernetes boasts of tools that help orchestrate a large and complex application on a container, but it also lets you decide on many aspects. You are supposed to choose the operating system, continuous integration/continuous delivery (CI/CD) tooling, container runtime, application services, storage, and many other components of the cluster. 

You also have to work on things like multitenancy, access control, and secure default settings. In addition to this, you have to decide whether you are interested in running Kubernetes on your own or you would like to choose a vendor who can provide you with a supported version.

In Conclusion

We would like to mention that Kubernetes is known for its flexibility because it provides users with the freedom of choice. Even though it can be a bit challenging to implement, Kubernetes offers you powerful features so that you can run containerized applications according to your own preferences. Now that you know all the details regarding Kubernetes Architecture it’s time for us to bid adieu!

Leave a Comment