Kubernetes User Handbook

This Kubernetes cheat sheet is designed for the one who has interested and learning about the file management and using Kubernetes as a tool, then this sheet will be a handy reference sheet. Don’t worry if you are a beginner and have no idea about how Kubernetes works, this Kubernetes cheat sheet will give you a quick reference of the basics that you must know to get started.
Prepare yourself for the Top DevOps Interview Questions And Answers!

Watch this video on Kubernetes Tutorial for Beginners


You can also download the printable PDF of Kubernetes Cheat Sheet.
Kubernetes Cheat Sheet

What is Kubernetes?

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

  • It is a container orchestrator
  • It can run Linux container:
    • Launch container.
    • Maintain and monitor container site.
    • Performs container-oriented networking.

Become Master of DevOps by going through this online DevOps training in London.

Architecture/interaction

ArchitectureKey concepts

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

  • Pod: These are the group of containers.
  • Labels: These are used to identify the pods.
  • Kubelet: They are container agents, responsible for maintaining the set of pods.
  • Proxy: They are the Load balancer for pods, helping in distributing tasks across the pods.
  • Etcd: A Metadata service.
  • Cadvisor: For resource usage and performance stats.
  • Replication controller: It manages pod replication.
  • Scheduler: Used for pod scheduling in worker nodes.
  • API server: Kubernetes API server.

Now let’s understand the role Master and Node play in the Kubernetes Architecture.
Go through the Best DevOps Course in New York to get clear understanding of DevOps.

Watch this video on DevOps Tutorial for Beginners

Master

  • It is responsible for maintaining the desired state for the cluster you are working on.
  • “Master” indicates a set of processes that are used to manage the cluster.
  • It contains service info, API, scheduler, replication controllers, and master.

Master

Worker node/ Minions

Also called as minion, it contains the services necessary to run the pods that are managed by the master.

  • Some services include: Container Runtime, Kubelet, Kube-proxy.
  • Contains: Kubelet, cAdvisor, Services, Pods & Containers.

Worker node
Moving forward, let’s check these important commands.

Learn more about DevOps in this DevOps training in Sydney to get ahead in your career!

Kubectl Command list

  • Pods and container introspection

COMMANDSFUNCTION
Kubectl get podsLists all current pods
Kubectl describe pod<name>Describes the pod names
Kubectl get rcList all replication controllers
Kubectl get rc –namespace=”namespace”Lists replication controllers in namespace
Kubectl describe rc <name>Shows the replication controller name
Kubectl get cvcLists the services
Kubectl describe svc<name>Shows the service name
Kubectl delete pod<name>Deletes the pod
Kubectl get nodes -wWatch nodes continuously
  • Debugging

FUNCTION COMMAND
Execute command on service by selecting container.Kubectl exec<service><commands>[-c< $container>]
Get logs from service for a containerKubectl logs -f<name>>[-c< $container>]
Watch the kubelet logsWatch -n 2 cat/var/log/kublet.log
Show metrics for nodeKubectl top node
Show metrics for podsKubectl top pod
  • Cluster Introspection

FUNCTIONCOMMAND
Get version informationKubectl version
Get cluster informationKubectl cluster-info
Get the configurationKubectl config g view
Output info about a nodeKubectl describe node<node>

Interested in becoming DevOps Expert? Click here to learn more in this DevOps Course in Toronto!

  • Objects

Some common objects used:

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 an industry-recognized certification in DevOps? Enroll in Intellipaat’s DevOps Course in Bangalore now!

Other Quick commands:

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

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

Now, you know the most important skill set of a DevOps Engineer. But, do you know, DevOps Engineers are among the highest paid professionals in the technology domain? so join DevOps training in Hyderabad!

Watch this Kubernetes Video

Features

  • Automated scheduling: It provides an advanced scheduler that helps launch container on cluster nodes.
  • Self-healing: Reschedule, replace and restart the dead containers.
  • Automated rollouts and rollbacks: It support rollback for systems in case of a failure, enables rollout and rollback for the desired state.
  • Horizontal scaling: It can scale up and down the app as per required, also it can be automated with respect to the CPU usage.
  • Service discovery and load balancing: It uses unique IP and DNS name to containers which helps in identify them across the different containers.

Download a Printable PDF of this Cheat Sheet

We have covered all the basics of Kubernetes in this cheat sheet. If you want to start learning DevOps in depth then check out the DevOps Certification by Intellipaat.
Not only will you get to learn and implement Kubernetes with a step by step guidance and support from us, but you will also get to learn other important topics in DevOps such as Docker, Chef, Git/GitHub, Ansible, Jenkins, Puppet, Selenium, Nagios and many more. You will also get 24*7 technical support to help you with any and all your queries, from the experts in the respective technologies here at intellipaat throughout the certification period. So, why wait? Check out the training program and enroll today!

Previous Next

Leave a Reply

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