Kubernetes Cheatsheet
minikube
¶
- To access the Kubernetes Dashboard, run this command in a shell after starting Minikube to get the address:
- The minikube VM is exposed to the host system via a host-only IP address, that can be obtained with the
minikube ip
command
kubectl
¶
- Run a particular image on the cluster (creates a deployment automatically)
kubectl run hello-world --replicas=2 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080
kubectl get
- list resources.kubectl get deployment
to get all deploymentskubectl get pods -l app=nginx
to get pods with label "app: nginx"kubectl describe
- show detailed information about a resourcekubectl logs
- print the logs from a container in a podkubectl exec
- execute a command on a container in a pod
Using the Docker daemon in the Minikube VM¶
When using a single VM of Kubernetes, it’s really handy to reuse the minikube’s built-in Docker daemon
Just make sure you tag your Docker image with something other than ‘latest’ and use that tag while you pull the image.
Otherwise, if you do not specify version of your image, it will be assumed as :latest
, with pull image policy of Always
correspondingly, which may eventually result in ErrImagePull as you may not have any versions of your Docker image out there in the default docker registry (usually DockerHub) yet.
A Docker client is required to publish built docker images to the Docker daemon running inside of minikube. See installing Docker for instructions for your platform.