Skip to content

Kubernetes

Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications.

Architecture

Cluster

A Kubernetes cluster is a set of node machines for running containerized applications. The Kubernetes Master is a collection of three processes that run on a single node in your cluster, which is designated as the master node. Those processes are: kube-apiserver, kube-controller-manager and kube-scheduler.

Node

The nodes in a cluster are the machines (VMs, physical servers, etc) that run the applications and workflows. The Kubernetes master controls each node.

Design

Kubernetes is declarative by design. When you want to change something in the cluster, you simply create/update/delete the resources from etcd via the API server. Various controllers then respond to this change by converging the system to comply with the newly declared state. To best understand, check out this drawing from Julia Evans:

Declarative: you declare what you want the system to do - a desired state - and the system will align towards that state. In Kubernetes, you create an API object to represent what you want the system to do. And all the components in the system work to drive towards that state, until the object is deleted.

Pods

A Pod is the basic execution unit of a Kubernetes application – the smallest and simplest unit in the Kubernetes object model that you create or deploy.

Services

A Service is an abstraction which defines a logical set of Pods and a policy by which to access them.

Deployments

Deployments abstract away the low level details of managing Pods. Behind the scenes, Deployments rely on ReplicaSets to manage starting, stopping, scaling, and restarting the Pods if they happen to go down for some reason. Below is an example illustration of a deployment.