Learning Kubernetes can be daunting!
"Cluster"... "Deployments"... "Services"... what?!
As a newcomer to these concepts one is faced with either of two choices:
- Watch a 20-hour long Udemy course
- Dive into the docs which is probably longer than the King James Bible. And with a million links leading to an altogether new concept.
So you end up with a couple of half-finished courses, thousands of tabs of the docs pages open, some youtube videos, but mostly a great deal of confusion and regret!
Sooooo we decided to write a series of blog posts to help a young cadet like yourself, get abreast quickly with the important concepts in kubernetes, in bite-sized posts with only need-to-know "points" to grasp the essentials. Our goal here is to choose the path of least resistance to set sail!
Feel free, of course, to move on after you're done here, to the official documentation and/or a detailed course, or get your hands dirty and deploy your own apps, or maybe even get certified. But assuredly, whatever you choose, you'll be able to go in with a certain level of confidence!
- A kubernetes or k8s "cluster" consists of a set of k8s "nodes" i.e. machines.
- K8s cluster: set of k8s nodes grouped together.
- K8s node: the physical/virtual machine on which k8s software and tools are installed.
- There are 2 types of nodes in a k8s cluster:
- K8s worker node: machine where the containers will be launched by k8s.
- K8s master node: responsible for managing the worker nodes.
- The master node is the node with the k8s "control plane" components installed, we'll understand this in more detail.
- The master node is responsible for the orchestration of containers on the worker nodes.
- Kubernetes comprises of the following main components:
- The API server is the front-end for the Kubernetes control plane.
- It exposes the Kubernetes API and allows us to interact with the k8s cluster.
- etcd is a distributed key-value store that stores all the data used to manage the cluster.
- It is used to store the configuration data, metadata and the current state of all the k8s objects in the cluster.
- it is responsible for implementing logs within the cluster.
- The kubelet is an "agent" that runs on each node in the cluster.
- It makes sure that containers are running in a pod.
- The container runtime is the underlying software that is responsible for running containers e.g. docker.
- It is responsible for making sure that the specified number of pods are running at any given time and bring up new containers.
- It is responsible for making sure that the containers are running on the right node.
- The master node has the
kube-apiserverinstalled, worker nodes have the
- All info about worker nodes is stored in a key-value store on the master i.e.
schedulerexist also, on the master.
container runtimelike docker runs on the worker nodes.
Some basic commands:
# run 1000 instances of my-app $ kubectl run --replicas=1000 my-app # scale it up to 5000 instances $ kubectl scale --replicas=5000 my-app # update these 5000 instances in a rolling upgrade $ kubectl rolling-update my-app --image=<image name>:<image tag> # rollback updates $ kubectl rolling-update my-app --rollback # deploy an app on a cluster $ kubectl run <image name> # see info about the cluster $ kubectl cluster-info # list all nodes in the cluster $ kubectl get nodes
We will now, over the next few posts, explore the "objects" in kubernetes, e.g. pods, deployments, services, etc.
These are the entities in the k8s architecture that we will be working with to deploy an application on k8s.
Following are the k8s objects that we'll be looking at:
OBJECT DESCRIPTION Pods The lowest level, single instance of an application ReplicaSets The next level, manages a set of pods Deployments The next level, manages a set of ReplicaSets Services The next level, manages a set of deployments Ingress The next level, manages a set of services Volumes The next level, manages a set of ingress Namespaces The next level, manages a set of volumes Cluster The highest level, manages a set of namespaces
In Part 2 we shall start by taking a look at "pods" in kubernetes.
Thank you for reading, hope you're excited!