Kubernetes CheatSheet

Thomas Dubiel
2 min readApr 3, 2021

--

When learning a new language, DSL or technology in general, keeping track of all the new commands can be a pain. Recently I’ve been learning Kubernetes, which is an open source system for deploying containerized applications. Learning this technology is hard enough, so I thought I would compile a short list of the most commonly used commands while working with Kubernetes. Commands for MiniKube, which is a version of Kubernetes that can be used locally on your machine, are included as well. Using MiniKube is the best way of learning Kubernetes as it circumvents the need to do a ton of configuration work, and you get to learning Kubernetes right away.

To install MiniKube, you would run the following code on Linux:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube

And the following command to initialize your Minikube cluster:

minikube start

The following is a list of the most commonly used commands that I have come across, so feel free to save this page for quick reference as you are learning Kubernetes.

minikube start

kubectl get nodes

minikube status

kubectl version

minikube delete

minikube status

kubectl get pod

kubectl get services

kubectl create deployment [name] [optional parameters]

kubectl get deployment [name]

kubectl get replicaset

kubectl edit deployment [name]

kubectl create deployment [name] --image=name

kubectl logs

kubectl describe pod [name]

kubectl logs [name]

kubectl exec -it [name] -- bin/bash

kubectl delete deployment [deployment name]

vim nginx-deployment.yaml

kubectl apply -f nginx-deployment.yaml

kubectl delete -f [filename]

References

Conclusion

The documentation for Kubernetes and MiniKube is great, and plenty more resources can be found online. Hopefully having a consolidated list of the most commonly used commands will be of help to those learning this increasingly ubiquitous technology.

--

--

Thomas Dubiel
Thomas Dubiel

No responses yet