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:
You can also download the printable PDF of this 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:
The below image illustrates the architecture of Kubernetes. Let’s have a look at it.
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!
- 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.
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.
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!
For Pods and Container Introspection
|Kubectl get pods||Lists all current pods|
|Kubectl describe pod<name>||Describes pod names|
|Kubectl get rc||Lists 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 cvc||Lists services|
|Kubectl describe svc<name>||Shows a service name|
|Kubectl delete pod<name>||Deletes a pod|
|Kubectl get nodes -w||Watches nodes continuously|
|To execute the command on service by selecting a container||Kubectl exec<service><commands>[-c< $container>]|
|To get logs from the service for a container||Kubectl logs -f<name>>[-c< $container>]|
|To watch kubelet logs||Watch -n 2 cat/var/log/kublet.log|
|To show metrics for a node||Kubectl top node|
|To show metrics for a pod||Kubectl top pod|
For Cluster Introspection
|To get version-related information||Kubectl version|
|To get cluster-related information||Kubectl cluster-info|
|To get configuration details||Kubectl config g view|
|To get information about a node||Kubectl describe node<node>|
Do you aspire to become a DevOps expert? Sign up today for the Best DevOps Course in Toronto!
Some of the common objects used in Kubernetes are mentioned in the below table:
|cm= conf gmaps||controllerrevisions||crd=custom resource definition|
|Cronjobs||cs=component statuses||csr= certificate signing requests|
|Deploy=deployments||ds= daemon sets||ep=end points|
|ev= events||hpa= horizontal pod autoscaling||ing= ingress|
|jobs||limits=limit ranges||Netpol- network policies|
|No = nodes||ns= namespaces||pdb= pod distribution budgets|
|po= pods||Pod preset||Pod templates|
|Psp= pod security policies||Pv= persistent volumes||pvc= persistent volume claims|
|quota= resource quotas||rc= replication controllers||Role bindings|
|roles||rs= replica sets||sa= service accounts|
|sc= storage classes||secrets||sts= stateful sets|
Interested in getting a top-rated certification in DevOps? Join Intellipaat’s DevOps Course in Bangalore today!
Other Quick Commands
Additionally, we do have some quick commands that are often very useful:
|To launch a pod with a name and an image||Kubectl 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 instances||Kubectl scale –replicas=<count>rc<name>|
|To map the external port to the internal replication port||Expose 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 namespace||Kubectl create namespace <namespace>|
|To allow the master node to run pods||Kubectltaintnodes –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!
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!