[Kubernetes] – P.1 – Clusters

Kubernetes Clusters

Kubernetes coordinates a highly available cluster of computers that are connected to work as a single unit.

The abstractions in Kubernetes allow you to deploy containerized applications to a cluster without tying them specifically to individual machines. To make use of this new model of deployment, applications need to be packaged in a way that decouples them from individual hosts: they need to be containerized.

Kubernetes automates the distribution and scheduling of application containers across a cluster in a more efficient way.

Cluster Diagram

A Kubernetes cluster consists of two types of resources: the Master and the Nodes. While Master coordinates the cluster, the Nodes are workers that run applications.

The Master

The Master is responsible for managing the cluster. The master coordinates all activities in your cluster, such as scheduling applications, maintaining applications’ desired state, scaling applications, and rolling out new updates.

The Nodes

A node is a VM or a physical computer that serves as a worker machine in a Kubernetes cluster. Each node has a Kubelet, which is an agent for managing the node and communicating with the Kubernetes master. The node should also have tools for handling container operations, such as Docker or rkt. A Kubernetes cluster that handles production traffic should have a minimum of three nodes.

The Master works with the Nodes

When you deploy applications on Kubernetes, you tell the master to start the application containers. The master schedules the containers to run on the cluster’s nodes. The nodes communicate with the master using the Kubernetes API, which the master exposes. We can also use the Kubernetes API directly to interact with the cluster.

A Kubernetes cluster can be deployed on either physical or virtual machines. To get started with Kubernetes development, you can use Minikube. Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node. Minikube is available for Linux, macOS, and Windows systems. The Minikube CLI provides basic bootstrapping operations for working with your cluster, including start, stop, status, and delete.

Demo

  • Make sure we installed Minikube on your local machine by command
minikube version
  • Start the cluster, by running the minikube start command
minikube start
  • To interact with Kubernetes, we’ll use the command line interface, it’s kubectl. Therefore, we need to install kubectl also. After that, verify by command
kubectl version
  • Let view the cluster detail by command:
kubectl cluster-info
  • To view the nodes in the cluster, run the kubectl get nodes command:
kubectl get nodes

Leave a Reply

Your email address will not be published. Required fields are marked *