Blog_Banner_Asset
    Homebreadcumb forward arrow iconBlogbreadcumb forward arrow iconArtificial Intelligencebreadcumb forward arrow iconKubernetes Cheat Sheet: Architecture, Components, Command Sheet

Kubernetes Cheat Sheet: Architecture, Components, Command Sheet

Last updated:
14th Dec, 2020
Views
Read Time
6 Mins
share image icon
In this article
Chevron in toc
View All
Kubernetes Cheat Sheet: Architecture, Components, Command Sheet

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

Top Machine Learning and AI Courses Online

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.

Ads of upGrad blog

About Kubernetes

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.

Trending Machine Learning Skills

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:

  • Maximize resources by making better use of hardware.
  • A container orchestrator across multiple hosts.
  • Automate the deployment process and updates.
  • Able to run a Linux container.
  • Auto-scaling helps in launching containers on cluster nodes.
  • Scaling up and down as required.
  • Self-healing by replacing, rescheduling, and restarting the dead containers.
  • Automated rollbacks and rollouts.
  • Load balancing and service discovery.
  • Auto-restart, auto-placement, and auto-replication, etc. 

Read: Deep Learning Algorithm

Architecture of Kubernetes

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.

  • The master of Kubernetes schedules the deployments, exposes the API and manages the overall Kubernetes cluster.
  • The node runs a container runtime, agent for communicating with the master, and other monitoring components, logging, etc.

Components of Kubernetes architecture

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:

  • API server: Kubernetes API server
  • Scheduler: Used for pod scheduling in worker nodes
  • Controller: Manages pod replication
  • Etcd: A metadata service

Nodes

It contains necessary services that are important for running the pods. The master manages the nodes. It is also called Minion. It contains:

  • Pod: Group of containers
  • Docker: Container-based technology, user space of OS.
  • Kubelet: Container agents that are responsible for maintaining the set of pods.
  • Kube-proxy: Routes traffic coming into a node from the service

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:

  • Pod and Container Introspection
  • Cluster Introspection
  • Debugging
  • Quick Commands
  • Objects

Pods and Container Introspection

FunctionalityCommand
For describing pod namesKubectl describe pod<name>
For listing all current podsKubectl get pods
For listing all replication controllersKubectl get rc
For showing the replication controller nameKubectl describe rc <name>
For listing replication controllers in a namespaceKubectl get rc –namespace=”namespace”
For showing a service nameKubectl describe svc<name>
For listing servicesKubectl get cvc
For watching nodes continuously.Kubectl get nodes -w
For deleting a podKubectl delete pod<name>

 Cluster Introspection

FunctionalityCommand
For getting version-related informationKubectl version
For getting configuration detailsKubectl config g view
For getting cluster-related informationKubectl cluster-info
For getting information about a nodeKubectl describe node<node>

Debugging Commands

FunctionalityCommand
For displaying metrics for a podKubectl top pod
For displaying metrics for a nodeKubectl top node
For watching Kubelet logsWatch -n 2 cat/var/log/kublet.log
For getting logs from the service for the containerKubectl logs -f<name>>[-c< $container>]
For the execution of the command on service by selecting a containerKubectl exec<service><commands>[-c< $container>]

Quick Commands

The below quick commands are often used and hence, very useful.

FunctionalityCommand
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
AllController revisions
cm= conf gmapsCluster role bindings
Cronjobscs=component statuses
Deploy=deploymentslimits=limit ranges
ev= eventshpa= horizontal pod autoscaling
jobsds= daemon sets
No = nodesns= namespaces
po= podsPod preset
Psp= pod security policiesPv= persistent volumes
quota= resource quotasrs= replica sets
rolesrc= replication controllers
sc= storage classespdb= pod distribution budgets
clusterrolessecrets
crd=custom resource definitionPod templates
csr= certificate signing requestssa= service accounts
Netpol- network policiesRole bindings
ing= ingresspvc= persistent volume claims
ep=end pointssts= stateful sets

Also Read: Regularization in Deep Learning

Kubernetes Command Cheat Sheet

All the basic information about Kubernetes, it’s architecture and commands are shown in below Kubernetes cheat sheet: 

Ads of upGrad blog

Popular AI and ML Blogs & Free Courses

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.

Profile

Pavan Vadapalli

Blog Author
Director of Engineering @ upGrad. Motivated to leverage technology to solve problems. Seasoned leader for startups and fast moving orgs. Working on solving problems of scale and long term technology strategy.
Get Free Consultation

Select Coursecaret down icon
Selectcaret down icon
By clicking 'Submit' you Agree to  
UpGrad's Terms & Conditions

Our Popular Machine Learning Course

Frequently Asked Questions (FAQs)

1What is Kubernetes?

Kubernetes is an open-source platform for automating deployment, scaling, and management of containers. A container is a ready-to-run software package that contains everything required to run the application: code, runtime environment, application, and system libraries. The containers are like logical units of application, and when Kubernetes groups them, it becomes easy to manage and discover the containers. These containers are deployed and scaled across hosts to provide a container-centric infrastructure. In short, it is a platform that manages the entire lifecycle of containerized applications.

2What are the main components of Kubernetes architecture?

There are two main components in the Kubernetes architecture- master node and worker node. A node is the main worker machine which is important for running a group of clusters called pods. The whole cluster is managed by the master node, whereas the worker node performs the tasks assigned by the master node. These nodes have many inbuilt components within them. The master node contains Kubernetes API Server, Kubernetes Scheduler, Kubernetes Controller, and Etcd. The worker node has pod, docker, kubelet, and kube-proxy.

3What do kubelet and kube-proxy do?

Kubelet, which is present in every node, ensures that containers are running well in a pod. It does so by taking a set of PodSpecs provided mainly through apiserver and checking the containers present in those PodSpecs. A PodSpec is a YAML or JSON object that describes a pod. Kubernetes Network Proxy, also known as kube-proxy, maintains network rules on nodes. Communication from network sessions inside or outside the cluster to pods is possible through these network rules. Kube-proxy forwards the traffic if the OS packet filtering layer is not available.

Explore Free Courses

Suggested Blogs

Top 9 Python Libraries for Machine Learning in 2024
74379
Machine learning is the most algorithm-intense field in computer science. Gone are those days when people had to code all algorithms for machine learn
Read More

by upGrad

19 Feb 2024

Top 15 IoT Interview Questions &#038; Answers 2024 – For Beginners &#038; Experienced
63882
These days, the minute you indulge in any technology-oriented discussion, interview questions on cloud computing come up in some form or the other. Th
Read More

by Kechit Goyal

19 Feb 2024

Data Preprocessing in Machine Learning: 7 Easy Steps To Follow
147020
Summary: In this article, you will learn about data preprocessing in Machine Learning: 7 easy steps to follow. Acquire the dataset Import all the cr
Read More

by Kechit Goyal

18 Feb 2024

Artificial Intelligence Salary in India [For Beginners &#038; Experienced] in 2024
906249
Artificial Intelligence (AI) has been one of the hottest buzzwords in the tech sphere for quite some time now. As Data Science is advancing, both AI a
Read More

by upGrad

18 Feb 2024

24 Exciting IoT Project Ideas &#038; Topics For Beginners 2024 [Latest]
742526
Summary: In this article, you will learn the 24 Exciting IoT Project Ideas & Topics. Take a glimpse at the project ideas listed below. Smart Agr
Read More

by Kechit Goyal

18 Feb 2024

Natural Language Processing (NLP) Projects &amp; Topics For Beginners [2023]
105268
What are Natural Language Processing Projects? NLP project ideas advanced encompass various applications and research areas that leverage computation
Read More

by Pavan Vadapalli

17 Feb 2024

45+ Interesting Machine Learning Project Ideas For Beginners [2024]
323154
Summary: In this Article, you will learn Stock Prices Predictor Sports Predictor Develop A Sentiment Analyzer Enhance Healthcare Prepare ML Algorith
Read More

by Jaideep Khare

16 Feb 2024

AWS Salary in India in 2023 [For Freshers &#038; Experienced]
903517
Summary: In this article, you will learn about AWS Salary in India For Freshers & Experienced. AWS Salary in India INR 6,07,000 per annum AW
Read More

by Pavan Vadapalli

15 Feb 2024

Top 8 Exciting AWS Projects &#038; Ideas For Beginners [2023]
95507
AWS Projects & Topics Looking for AWS project ideas? Then you’ve come to the right place because, in this article, we’ve shared multiple AWS proj
Read More

by Pavan Vadapalli

13 Feb 2024

Schedule 1:1 free counsellingTalk to Career Expert
icon
footer sticky close icon