What is a Kubernetes cluster?

image credit: Stephen Grider

Kubernetes, often abbreviated as k8s, is revolutionizing how applications are deployed and managed in the cloud. At the heart of Kubernetes are clusters, which consist of a master and nodes. Understanding this architecture is crucial for anyone diving into the world of container orchestration.

The Master: Your Cluster’s Control Center

The master serves as the control center of a Kubernetes cluster. It’s responsible for the overall management of the cluster, overseeing all the nodes and ensuring that the desired state of the cluster is maintained.

  • API Server: The primary interface to the cluster. When you interact with a Kubernetes cluster, you’re essentially communicating with the master’s API server.
  • Controller Manager: Manages the controllers that regulate the state of the cluster, ensuring that the current state matches the desired state.
  • Scheduler: Responsible for scheduling pods (groups of one or more containers) onto nodes.
  • etcd: A consistent and highly-available key value store used as Kubernetes’ backing store for all cluster data.

The Nodes: Workers of the Cluster

Nodes are the workhorses of a Kubernetes cluster. Each node can host multiple containers, which are instances of different images, performing various tasks.

  • Kubelet: An agent running on each node, communicating with the master.
  • Kube-proxy: Maintains network rules on nodes. These network rules allow network communication to your Pods from network sessions inside or outside of your cluster.
  • Container Runtime: The software responsible for running containers (e.g., Docker).

Here’s a basic example of defining a Node in a Kubernetes YAML configuration file:

apiVersion: v1
kind: Node
metadata:
name: node-example
spec:
podCIDR: '192.0.2.0/24'
providerID: 'provider-id'

Container Orchestration

In Kubernetes, containers are organized into pods, the smallest deployable units. Each pod can contain one or more containers that share resources and are scheduled together on the same node.

,