Show Menu

Kubernetes (k8s) Cheat Sheet by

Kubernetes (k8s)


Define :it is a container management technology developed by GOOGLE (later made open source in 2015) to manage contai­nerized applic­ati­on(­orc­hes­tra­tion).


1.Service discovery and load balancing 1.Service discovery and load balancing
2.Auto­mated rollbacks
4.Auto Scaling
5.Canary updates and Rolling updates
6.Open source & Community driven
7.High Availa­bility

Kubernetes Concepts

machine in the cluster
helps in creation of containers that includes apps and its binaries.
A Pod is the basic building block of Kubern­­et­e­s–the smallest and simplest unit in the Kubernetes object model that you create or deploy,is also a group of containers (1 or more).Only containers of same pod can share shared storage.
is an abstra­­ction which defines a logical set of Pods and a policy by which to access them.
Creates pod(s) and ensures that a specified number succes­­sfully comple­ted.When a specified number of successful run of pods is completed, then the job is considered complete.
job scheduler in K8s
ensures how many replica of pod should be running.
Logical seperation between teams and thier enviro­nme­nts.It allows various teams(­Dev­,Prod) to share k8s cluster by providing isolated workspace.
Desired state of pods for declar­­ative updates
ensures a particular pod to be run on some or all nodes
Persistent storage in the cluster with an indepe­­ndent lifecycle.
Request for storage (for a Persi­­ste­­nt­V­o­lume) by a user
An Ingress is a collection of rules that allow inbound connec­­tions to reach the cluster services.


kubectl get all --all-­nam­espaces
shows all objects of all namespaces
kubectl get pods --all-­nam­espaces
shows pods of all namespaces
kubectl get pods -n <name space>
shows pods of a namespace eg.kubectl get all -n kube-s­ystem :shows objects of system name space
kubectl get namespaces (show all namspaces)
default:default name spaces of user
kube-p­ublic:Namespace for resources that are publicly availa­ble­/re­adable by all
kube-s­ystem:Namespace for object­s/r­eso­urces created by Kubernetes systems

Components Archit­ecture Diagram

Components Basic

Components in Manager Nodes:
Controller manager: Runs various contro­llers to help move running state to desired state.
Node Controller: Respon­sible for noticing and responding when nodes go down.
Replic­ation Controller: Respon­sible for mainta­ining the correct number of pods for every replic­ation controller object in the system.
Endpoints Controller: Populates the Endpoints object (i.e, joins Services & Pods).
Service Account & Token Contro­llers: Create default accounts and API access tokens for new namesp­aces.
Scheduler: Watches newly created pods that have no node assigned, and selects a node for them to run on.
Api Server:The front-end for the Kubernetes control plane. It is designed to scale horizo­nta­lly.Every other component contact with this to commun­icate.
Etcd Cluster: key/value backing store for cluster data,it stores state of the cluster (what nodes exist in the cluster, what pods should be running, which nodes they are running on, and a whole lot more) at any given point of time.
Components in Worker Nodes:
Kubelet:Agent that contin­uously watches API server. It makes sure that containers are running in a pod.
Kube-proxy: a proxy service that runs on each worker node to deal with individual host subnetting and expose services to the external world. It performs request forwarding to the correct pods/c­ont­ainers across the various isolated networks in a cluster.

Various Ways of installing K8s

single node cluster
multinode cluste­r(d­oesn't support kubenet, hence require CNI[co­ntainer network interface] plugin eg. flannel.
multi node
Important: The network must be deployed before any applic­ations. Also, CoreDNS will not start up before a network is installed. kubeadm only supports Container Network Interface (CNI) based networks (and does not support kubenet).

Output format in get

-o wide
width wise details output
-o yaml
details output in yaml format
-o json
details output in json format


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          kenv使用方法 Cheat Sheet
          Docker & Swarm 2022 Cheat Sheet
          Docker basics Cheat Sheet

          More Cheat Sheets by gauravpandey44