Kubernetes architecture – how it works

Take a look at the following diagram:

Kubernetes has two key components: 

  • Kubernetes master: This is the primary control unit of Kubernetes. This is for managing workloads and for ensuring smooth communication across all the participating components of the system; it manages workloads and communication across the system. There are several important modules, and each module can run on the master node or can be made to run on multiple master nodes to improve its availability. Its prime modules are as follows:
    • Storage: etcd is an open source and popular key value data store, and this is centralized to enable all the nodes in the cluster to access it. Kubernetes uses this database to store all cluster configuration data, and this data collectively represents the overall state of the cluster at any point in time.
    • API server: This is the most important and RESTful API-attached central management module. This can receive REST requests for bringing forth all kinds of modifications. This serves as a frontend server to control the full cluster and its nodes in a systematic manner. This is the only component that is enabled to communicate with the etcd database and the configuration data.
    • Scheduler: This is another vital module of the Kubernetes master node, and based on the evolving requirements and resource utilization, the scheduler helps in scheduling the pods on various nodes. This also decides which service is deployed on which pods and nodes.
    • Controller manager: This runs several controller processes to continuously monitor and manage the shared state of the cluster. If there is any change required in the service, the controller immediately understands the change and starts the necessary activities to attain the new desired state.
  • Worker node: This is the execution node, and it gets relevant information to adeptly manage container collaboration. Also, this is in constant touch with the master node. It also receives the details from the master node to assign container resources to workloads as per the schedule:
    • Kubelet: This module ensures that all containers in the node are running perfectly, without any issues. Kubelet also meticulously monitors whether the pods are in the desired state. If a node fails, then the replication controller is activated to observe this failure and to launch pods in a functional node.
    • Kube-Proxy: This doubles up as a network proxy and also as a load balancer. Its main job is to forward requests to the correct pods across nodes in a cluster.
    • cAdvisor: This is responsible for monitoring and gathering resource usage and performance metrics on each node.

Further we have following topics which are included in Kubernetes architecture:

  • Pods: They are the Kubernetes unit of application deployment. Pods, in turn, can comprise one or more containers. Containers can run inside VMs and BM servers. Pods are the single smallest intractable unit in Kubernetes. A pod gets its own IP address, which is shared among its containers.
  • Nodes: They are the physical machines (in other words, BM servers). Nodes provide the available cluster resources for the Kubernetes platform to keep data, run jobs, optimize workloads, and create network routes. The other prominent component of the Kubernetes platform is Labels, which help Kubernetes and its end users to filter similar resources in the system. They are the glue between participating resources. For example, a service wants to open ports for an application deployment. For monitoring, logging, debugging, and testing purposes, any Kubernetes resource has to be labeled accordingly so that when opening ports, Kubernetes, based on the Labels, does the correct thing. Annotations are used to keep metadata for different objects in the form of freestyle strings. The following is an example for annotation: Reason for change: Upgrading the application version for security patches.
  • ReplicaSets: As previously mentioned, the number of pods to keep applications running comfortably and the addition or deletion of pods is essential. Kubernetes uses ReplicaSets. A replication controller makes sure that a cluster is running the required number of equivalent pods. If there are too many pods, then the replication controller can remove those extra pods. If there are less pods running, then it will add more to maintain the specified number of pods.
  • Kubernetes StatefulSets: They provide resources such as volumes, stable network IDs, and ordinal indexes from 0 to N to deal with stateful containers. Volume is an important feature to run the stateful application. Two main types of volumes are supported:
    • Ephermal storage volume: The volume consists of any number of containers running within a pod. Data is stored across the containers. But if pods are killed, the volume is automatically removed.
    • Persistent storage: This is a permanent data-storage mechanism. Even when the pod gets killed or moved to another node, data is stored in a remote location till it gets deleted by the user.
  • DaemonSets: Certain applications require only one instance of a workload on every node. A good example is a log collector, which collect logs from all the nodes in the cluster. The log collector agent (only one instance) has to be present in all nodes. To create such a workload deployed, Kubernetes uses this feature.
  • Jobs: As the majority of applications require constant uptime to simultaneously server requests, there is the need for batches of jobs to be spawned and cleaned up once finished. To do this, we can use this feature. A job creates one or more pods and ensures that a specified number of pods gets terminated once the job is over. A good example can be a set of workers reading jobs from a queue of data to be processed and stored. Once the queue is empty, the workers are not required, until the next batch is ready to be processed.
  • ConfigMaps and secrets: An application has to be completely agnostic to its location. To achieve this, the ConfigMaps capability is used. This is essentially a list of key-value environment variables that are passed to running workloads to determine different runtime behaviors. Secrets are the same, except that they are encrypted to prevent sensitive information, such as keys, passwords, certificates, and so on, getting hacked on the way.
  • Deployments: In the agile world, we want to build, test, and ship in small chunk, to receive immediate feedback from users. Kubernetes makes it easy to deploy new software or a newer version of existing software, using deployments. These are sets of metadata describing new requirements from a certain running workload. With the assistance of the Kubernetes platform, it is possible to do automated roll outs and rollbacks of applications. Kubernetes also comes in handy in performing canary deployments. A number of promising and potential programming languages are being supported in Kubernetes.
  • Security: Kubernetes provides a variety of other operational facilities such as DNS management, resource monitoring, logging, and storage orchestration. It is a widely reported that container security is the major barrier for the slow adoption of containers in production environments. While container security drawbacks are simultaneously identified and solved, the Kubernetes platform also addresses security as one of the primary things.

Kubernetes can run not only Docker containers, but also containers from other vendors. Kubernetes supports horizontal infrastructure provisioning and scaling. The automated scaling of newer resources is facilitated through the Kubernetes platform. Kubernetes handles the availability of both applications and infrastructure extremely well. Kubernetes ensures that applications do not fail by consistently checking the health of pods and containers. Another feature for ensuring the high availability of Kubernetes clusters is load balancing. The Kubernetes load balancer distributes the load across multiple pods.  

Containerization has gained its mesmerizing popularity because it has the inherent strength and sagacity to accelerate and automate the process of software building, testing, and release.

The growing open source community is consistently adding new features into the Kubernetes platform to present Kubernetes as the highly accomplished and acclaimed platform for smoothening containerized clouds. Kubernetes simplifies the tasks of the DevOps team drastically, ensuring IT agility and adaptivity, which in turn, improve business versatility. Without Kubernetes, software engineering teams have to script their own software deployment, scale it manually, and update workflows. For a large enterprise, these tasks are handled by a large team. Kubernetes by leveraging the various automation being provided by containers, help to develop and deploy cloud enabled and native applications. Precisely speaking, Kubernetes brings in a beneficial abstraction on IT hardware to achieve portability, maneuverability, accessibility, scalability, availability, and so on. In a very short time, Kubernetes has become the most important technology for adroitly running containerized clouds and speeding up application deployment. Here is another macro-level Kubernetes architecture:

Kubernetes has become an attractive phenomenon for application developers because it takes away the dependency on IT operations team. Kubernetes also speeded up the leverage of the pioneering benefits of the containerization paradigm. Containers are penetrating into production environments because of the power of Kubernetes. Kubernetes not only orchestrates stateless containers, but also works with stateful containers. That means enterprise-level transactional, operational, and analytical applications are also being deployed and managed by Kubernetes. There are several reasons why Kubernetes is sweeping the entire IT world today. Firstly, it can run on any infrastructure and in any environment. There are thousands of open source developers contributing to the Kubernetes community and sustaining the Kubernetes journey. Kubernetes is stuffed with a number of APIs and a full number of modular components, so adding new components and integrating with third-party tools are quite simple.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.71.237