Kubernetes Cheat Sheet: Architecture, Components, Command Sheet
Updated on Sep 26, 2022 | 6 min read | 13.2k views
Share:
For working professionals
For fresh graduates
More
Updated on Sep 26, 2022 | 6 min read | 13.2k views
Share:
Table of Contents
Kubernetes has become an essential part of industries and is changing the world of technology. Janet Kuo, the co-chair of KubeCon, addressed the Kubernetes features and its importance in the coming time. She talks about the Kubernetes extensions and solutions that will change the world.
This cheat sheet will provide a reference to working professionals in the implementation of Kubernetes. It contains all the necessary details to help beginners who are new to Kubernetes. The Kubernetes Cheat Sheet is a quick and handy medium to refer to all the essential concepts and commands of Kubernetes.
Enrol for the Machine Learning Course from the World’s top Universities. Earn Masters, Executive PGP, or Advanced Certificate Programs to fast-track your career.
An open-source platform for automatic deployment and scaling containers across the clusters of hosts to provide container-centric infrastructure is known as Kubernetes (also known as “Kube” or k8s). It allows easy and efficient management of different hosts running Linux containers by clustering them.
Kubernetes is a platform that is designed for managing the life cycle of containerized applications and services completely. A Kubernetes user can define the ways in which an application should run and interact with different applications.
Users can switch traffic between different versions of applications, perform updates, scale up and down the services, etc. with Kubernetes. It offers users a high degree of flexibility, reliability, and power in managing applications.
Some of the major features of Kubernetes are:
Read: Deep Learning Algorithm
The architecture of Kubernetes consists of layers: Higher and lower layers. The complexity of abstracting the higher layer can be found in the lower layers. The individual physical or virtual machines are brought together into a cluster. A shared network is used for communication between each server. So, just like other distributed platforms, Kubernetes has one master (at least), and multiple compute nodes.
Let’s have a look at the purpose and components of master and nodes in the Kubernetes architecture.
Master
The master maintains the desired state of the cluster. Since it manages the whole cluster, it is called master. It contains:
Nodes
It contains necessary services that are important for running the pods. The master manages the nodes. It is also called Minion. It contains:
Now, let’s understand the important commands of Kubernetes.
Kubectl Commands
Kubectl is the command-line tool for Kubernetes. The basic Kubectl commands can be divided into:
Pods and Container Introspection
Functionality | Command |
For describing pod names | Kubectl describe pod<name> |
For listing all current pods | Kubectl get pods |
For listing all replication controllers | Kubectl get rc |
For showing the replication controller name | Kubectl describe rc <name> |
For listing replication controllers in a namespace | Kubectl get rc –namespace=”namespace” |
For showing a service name | Kubectl describe svc<name> |
For listing services | Kubectl get cvc |
For watching nodes continuously. | Kubectl get nodes -w |
For deleting a pod | Kubectl delete pod<name> |
Cluster Introspection
Functionality | Command |
For getting version-related information | Kubectl version |
For getting configuration details | Kubectl config g view |
For getting cluster-related information | Kubectl cluster-info |
For getting information about a node | Kubectl describe node<node> |
Debugging Commands
Functionality | Command |
For displaying metrics for a pod | Kubectl top pod |
For displaying metrics for a node | Kubectl top node |
For watching Kubelet logs | Watch -n 2 cat/var/log/kublet.log |
For getting logs from the service for the container | Kubectl logs -f<name>>[-c< $container>] |
For the execution of the command on service by selecting a container | Kubectl exec<service><commands>[-c< $container>] |
Quick Commands
The below quick commands are often used and hence, very useful.
Functionality | Command |
For launching a pod with a name and an image. | Kubectl run<name> — image=<image-name> |
For creating a service described in <manifest.yaml> | Kubectl create -f <manifest.yaml> |
For scaling the replication counter to count the number of instances. | Kubectl scale –replicas=<count>rc<name> |
For mapping the external port to the internal replication port. | Expose rc<name> –port=<external>–target-port=<internal> |
For stopping all pods in <n> | Kubectl drain<n>– delete-local-data–force–ignore-daemonset |
For creating a namespace. | Kubectl create namespace <namespace> |
For allowing the master node to run pods. | Kubectltaintnodes –all-node-role.kuernetes.io/master- |
Objects
Some of the familiar objects used in Kubernetes are as follows:
List of Common Objects | |
All | Controller revisions |
cm= conf gmaps | Cluster role bindings |
Cronjobs | cs=component statuses |
Deploy=deployments | limits=limit ranges |
ev= events | hpa= horizontal pod autoscaling |
jobs | ds= daemon sets |
No = nodes | ns= namespaces |
po= pods | Pod preset |
Psp= pod security policies | Pv= persistent volumes |
quota= resource quotas | rs= replica sets |
roles | rc= replication controllers |
sc= storage classes | pdb= pod distribution budgets |
clusterroles | secrets |
crd=custom resource definition | Pod templates |
csr= certificate signing requests | sa= service accounts |
Netpol- network policies | Role bindings |
ing= ingress | pvc= persistent volume claims |
ep=end points | sts= stateful sets |
Also Read: Regularization in Deep Learning
All the basic information about Kubernetes, it’s architecture and commands are shown in below Kubernetes cheat sheet:
If you’re interested to learn more about deep learning techniques, machine learning, check out IIIT-B & upGrad’s PG Diploma in Machine Learning & AI which is designed for working professionals and offers 450+ hours of rigorous training, 30+ case studies & assignments, IIIT-B Alumni status, 5+ practical hands-on capstone projects & job assistance with top firms.
Get Free Consultation
By submitting, I accept the T&C and
Privacy Policy
Top Resources