Kubernetes User Handbook

This Kubernetes cheat sheet is prepared by our experts keeping in mind those learners who have started learning Kubernetes as a tool. This cheat sheet will be a handy reference for them when they start implementing what they have learned in real-life problems. In this Kubernetes cheat sheet, you get a quick reference to all the basics that you must know about Kubernetes.

Watch this video on Kubernetes Tutorial for Beginners:

Kubernetes Cheat Sheet

Learn for free ! Subscribe to our youtube Channel.

You can also download the printable PDF of this Kubernetes cheat sheet
Kubernetes Cheat Sheet

What is Kubernetes?

Kubernetes is an open-source platform used to automate deployment and to scale containers across clusters of hosts providing container-centric infrastructure.

  • It is a container orchestrator.
  • It can run a Linux container.
    • Launches a container
    • Maintains and monitors the container site
    • Performs container-oriented networking

Become a master of DevOps by taking up this online instructor-led DevOps Training in London!

Watch this video on Kubernetes Tutorial for Beginners:

Kubernetes Cheat Sheet

Learn for free ! Subscribe to our youtube Channel.

Architecture/Interaction

The below image illustrates the architecture of Kubernetes. Let’s have a look at it.

ArchitectureKey Concepts

Now, let’s discuss the key points of this architecture.

  • Pod: Group of containers
  • Label: Used to identify pods
  • Kubelet: Container agents, responsible for maintaining the set of pods
  • Proxy: The load balancer for pods, helping in distributing tasks across them
  • Etcd: A metadata service
  • CAdvisor: Used for monitoring resource usage and performance
  • Replication controller: Manages pod replication
  • Scheduler: Used for pod scheduling in worker nodes
  • API server: Kubernetes API server

Now, let’s understand the roles master and worker nodes play in the Kubernetes architecture.

Go through this Best DevOps Course in New York to get a clear picture of what exactly DevOps is!

Master Node

  • It is responsible for maintaining the desired state of the cluster we are working on.
  • The term ‘master‘ indicates a set of processes that are used to manage a cluster.
  • It contains Kubelet service info, API, scheduler, replication controller, and Kubernetes master.

Master

Worker Nodes/Minions

Also called a ‘minion,’ a worker node contains the services necessary to run the pods that are managed by the master.

  • Services it provides are Container Runtime, Kubelet, Kube-proxy, etc.
  • It contains Kubelet, cAdvisor, Services, Pods, and Containers.

Worker node
Wish to crack a DevOps interview? Prepare yourself with these Top DevOps Interview Questions and Answers!

Moving forward, let’s check out the important commands used in Kubernetes.


Learn more DevOps concepts from this DevOps Training in Sydney to get ahead in your career!

Kubectl Commands

For Pods and Container Introspection

CommandFunction
Kubectl get podsLists all current pods
Kubectl describe pod<name>Describes pod names
Kubectl get rcLists all replication controllers
Kubectl get rc –namespace=”namespace”Lists replication controllers in a namespace
Kubectl describe rc <name>Shows the replication controller name
Kubectl get cvcLists services
Kubectl describe svc<name>Shows a service name
Kubectl delete pod<name>Deletes a pod
Kubectl get nodes -wWatches nodes continuously

For Debugging

FunctionCommand
To execute the command on service by selecting a containerKubectl exec<service><commands>[-c< $container>]
To get logs from the service for a containerKubectl logs -f<name>>[-c< $container>]
To watch kubelet logsWatch -n 2 cat/var/log/kublet.log
To show metrics for a nodeKubectl top node
To show metrics for a podKubectl top pod

For Cluster Introspection

FunctionCommand
To get version-related informationKubectl version
To get cluster-related informationKubectl cluster-info
To get configuration detailsKubectl config g view
To get information about a nodeKubectl describe node<node>

Do you aspire to become a DevOps expert? Sign up today for the Best DevOps Course in Toronto!

Objects

Some of the common objects used in Kubernetes are mentioned in the below table:

Allclusterrolebindingsclusterroles
cm= conf gmapscontrollerrevisionscrd=custom resource definition
Cronjobscs=component statusescsr= certificate signing requests
Deploy=deploymentsds= daemon setsep=end points
ev= eventshpa= horizontal pod autoscalinging= ingress
jobslimits=limit rangesNetpol- network policies
No = nodesns= namespacespdb= pod distribution budgets
po= podsPod presetPod templates
Psp= pod security policiesPv= persistent volumespvc= persistent volume claims
quota= resource quotasrc= replication controllersRole bindings
rolesrs= replica setssa= service accounts
sc= storage classessecretssts= stateful sets

Interested in getting a top-rated certification in DevOps? Join Intellipaat’s DevOps Course in Bangalore today!

Learn for free ! Subscribe to our youtube Channel.

Other Quick Commands

Additionally, we do have some quick commands that are often very useful:

FunctionCommand
To launch a pod with a name and an imageKubectl run<name> — image=<image-name>
To create a service described in <manifest.yaml>Kubectl create -f <manifest.yaml>
To scale the replication counter to count the number of instancesKubectl scale –replicas=<count>rc<name>
To map the external port to the internal replication portExpose rc<name> –port=<external>–target-port=<internal>
To stop all pods in <n>Kubectl drain<n>– delete-local-data–force–ignore-daemonset
To create a namespaceKubectl create namespace <namespace>
To allow the master node to run podsKubectltaintnodes –all-node-role.kuernetes.io/master-

In the IT sector, DevOps Engineers are among the highest paid professionals. Sign up for this DevOps Training in Hyderabad today and be one of them!

Learn for free ! Subscribe to our youtube Channel.

Features of Kubernetes

  • Automated scheduling: It provides an advanced scheduler that helps launch containers on cluster nodes.
  • Self-healing: Rescheduling, replacing, and restarting of dead containers are possible.
  • Automated rollouts and rollbacks: It supports rollback for systems in the case of failures and enables rollout and rollback for the desired state.
  • Horizontal scaling: It can be scaled up and down as required and can be automated with respect to the CPU usage.
  • Service discovery and load balancing: It uses a unique IP and DNS name for containers that helps in identifying them.

Download a Printable PDF of the Cheat Sheet

We have covered all the basics of Kubernetes in this Kubernetes cheat sheet.

Do you want to learn more about DevOps in-depth? Sign up with the all-inclusive DevOps Certification Training designed by Intellipaat!

If you decide to enroll in this certification program, you are making the right step toward your DevOps career as, in this course, you will not only learn and implement Kubernetes with step-by-step guidance and support from us but you will get to learn other important topics in DevOps such as Docker, Chef, Git/GitHub, Ansible, Jenkins, Puppet, Selenium, Nagios, and much more.

Additionally, you will have 24/7 technical support, which will help you with all your queries, throughout the certification period.

So, why wait? Enroll now and be up and running!

1 thought on “Kubernetes Cheat Sheet”

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
3 + 10 =