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.
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.
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
- 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.
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.
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
|Kubectl get pods||Lists all current pods|
|Kubectl describe pod<name>||Describes the pod names|
|Kubectl get rc||List all replication controllers|
|Kubectl get rc –namespace=”namespace”||Lists replication controllers in namespace|
|Kubectl describe rc <name>||Shows the replication controller name|
|Kubectl get cvc||Lists the services|
|Kubectl describe svc<name>||Shows the service name|
|Kubectl delete pod<name>||Deletes the pod|
|Kubectl get nodes -w||Watch nodes continuously|
|Execute command on service by selecting container.||Kubectl exec<service><commands>[-c< $container>]|
|Get logs from service for a container||Kubectl logs -f<name>>[-c< $container>]|
|Watch the kubelet logs||Watch -n 2 cat/var/log/kublet.log|
|Show metrics for node||Kubectl top node|
|Show metrics for pods||Kubectl top pod|
Watch this video on How to learn Devops for Beginners
|Get version information||Kubectl version|
|Get cluster information||Kubectl cluster-info|
|Get the configuration||Kubectl config g view|
|Output info about a node||Kubectl describe node<node>|
Interested in becoming DevOps Expert? Click here to learn more in this DevOps Course in Toronto!
Watch this DevOps Salary Report video by Intellipaat:
Some common objects used:
|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 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:
|Launch a pod with a name an image||Kubectl 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 instances||Kubectl scale –replicas=<count>rc<name>|
|Map external port to internal replication port||Expose rc<name> –port=<external>–target-port=<internal>|
|To stop all pod in <n>||Kubectl drain<n>– delete-local-data–force–ignore-daemonset|
|To create namespace||Kubectl create namespace <namespace>|
|Allow master nodes to run pods||Kubectltaintnodes –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
- 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.
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!