With enterprises trying to use container technology for production-level deployment, cluster management and orchestration engines are gaining prominence. Of course, Kubernetes is one of the prominent orchestration engines out there. Pods and Nodes play an important role in the Kubernetes world. So let’s discuss the basics of these components.
A Pod can be defined as a collection of containers sharing network storage and instructions for operation. It works like a unit. All the containers in the Pod are co-located and co-scheduled. It’s basically an application-specific “logical host”.
Here are the characteristics of a Kubernetes Pod:
- Shared Storage: Shares the storage as Volumes.
- Unique IP: Has a unique cluster IP address assigned.
- Container Information: Includes information about container versions and instructions for container execution and port usage.
There are no hard and fast rules about how to combine containers to create a Pod. But the idea is to tightly couple one or more application containers together. In the physical or virtual machine world, a Pod would look like a single machine with hosting tightly-coupled applications.
When designing a Pod, Kubernetes developers should think about the Pod as an atomic unit. So you can put applications that will benefit from close proximity. For example, you can put a container for Node.js web application and the container that supplies it with data in the same Pod. This way the containers will benefit from the co-location and co-scheduling in a single Pod.
Pods are supposed to be easily replaceable. Each Pod is created by combining one or more application containers. Then it is deployed to a Node. It remains on the Node until its termination. If the Node fails the Kubernetes master components create similar Pods in the healthy Nodes of the cluster.
A Node is defined as a worker machine. In the early development of Kubernetes, a Node was called a minion. It can be a physical or virtual machine. The Master manages each Node. Multiple Pods can be deployed to a Node and there are no restrictions on what kind of Pods can be run on the Nodes. The Kubernetes Master handles the scheduling of the Pods across the various Nodes and keeps track of the available resources on them.
Here are the mandatory components of a Kubernetes Node:
- Kubelet: Each Node has a Kubelet. It is the intermediary between Kubernetes Master and the Kubernetes Nodes. The Kubelet process is responsible for running the Pods and the containers inside those Pods.
- Container Runtime: It is the container runtime manager. It pulls the container image from a registry, unpacks it and runs the container application.
Unlike Pods, Nodes are not created by Kubernetes directly. Kuberenetes takes the physical or virtual machine on your pool of resources in your cloud or data center and creates an abstraction. So when Kuberenetes is creating a Node, it is creating an object that represents the Node.
Pods and Nodes are fundamental concepts of Kubernetes. Containers are combined to create Pod workloads and then Pods are distributed to Nodes or work machines. Through the combination of Pods and Nodes, Kubernetes is able to build powerful clusters to support large-scale applications.
- Create a 2-node Kubernetes cluster in 10 minutes, YouTube Video