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.
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.
Learn DevOps in 16 hrs from experts
Now let’s discuss the key points of this architecture.
Now let’s understand the role Master and Node play in the Kubernetes Architecture.
Also called as minion, it contains the services necessary to run the pods that are managed by the master.
Moving forward, let’s check these important commands.
|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|
|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>|
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|
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-|
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
Download Interview Questions asked by top MNCs in 2019?