What is Kubernetes cluster? What are worker and master nodes?

A Kubernetes cluster is a cluster of nodes configured in a master/slave architecture that runs containerized applications. They are faster and more lightweight than virtual machines, making the deployment and scaling of applications easier and more manageable.

A Kubernetes cluster is made up of one master node and several worker nodes. The worker nodes are responsible for running the containers and doing any work assigned to them by the master node. The master node looks after:

  • scheduling and scaling applications
  • maintaining the state of the cluster
  • implementing updates

What is a container?

Simply put, a container is a sandbox for a process; this means that to a very large extent, we can isolate a process so that it has its own process space, namespace, and cgroup. Containers allow us to put restrictions on the process, such as we can limit the resources used. A process in a container typically can only see other processes in the same container and has no view of the processes running outside its walls. In the Kubernetes world, this is referred to as a pod. A pod is the smallest unit of deployable compute resources and consists of several containers on a single node, sharing resources such as storage and network access.

The Kubernetes cluster

A Kubernetes cluster is made up of at least one master node and one or more worker nodes. The master node makes up the control plane of a cluster and is responsible for scheduling tasks and monitoring the state of the cluster. The key advantage of the Kubernetes cluster is that it is not a physical cluster; rather, it is an abstraction. It does not matter whether the nodes in the cluster are virtual machines or bare-metal, on-premises, or on the cloud; Kubernetes can run containerized applications on any group of such machines.

Master node

The master node is responsible for running several Kubernetes processes that are absolutely necessary to run and manage the cluster properly:

  • API Server: This is essentially the entry-point to the Kubernates cluster, which itself is a container. This is the process that allows communication between different Kubernetes clients and the cluster. The clients include the UI, if we are using the Kubernetes Dashboard, the API if we are running scripts, or the command-line tool. All these clients talk to the API Server to interact with the cluster.

  • Controller Manager: This keeps track of the state of the cluster. It keeps an eye on the cluster and checks whether a node needs to be repaired or restarted.

  • Scheduler: Scheduler ensures proper pod placement on the worker nodes based on several factors such as the available resources and the current load on the cluster.

  • etcd: This is the key-value storage responsible for holding the state of the cluster at any given time. etcd has the configuration information and status data of each node in the cluster. etcd snapshots allow us to recover the whole cluster state, hence it is used in backing up and restoring a cluster.

Worker node

The worker nodes are the part of the Kubernetes clusters which actually execute the containers and applications on them. They have two main components, the Kubelet Service and the Kube-proxy Service.

  • Kubelet Service: Each worker node has a Kubelet process running on it that allows the cluster to talk to each other and execute some tasks on the worker nodes, such as running application processes. It listens for instructions from the Api Server and manages containers running on the node.

  • Kube-proxy Service: The Kube-Proxy Service is responsible for enabling communication between services within the cluster.

These worker nodes have docker containers for each application running on them. There may be a different number of containers running on each node depending on the distribution of the workload.

Worker nodes are generally more powerful than master nodes because they have to run hundreds of clusters on them. However, master nodes hold more significance because they manage the distribution of workload and the state of the cluster.

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved