Kubectl
Kubernetes command-line tool cheatsheet:
The Kubernetes command-line tool, kubectl controls the Kubernetes cluster manager.
We are going to use this tool extensively during this workshop, so we should get to know it.
To enable autocomplete
source <(kubectl completion bash) # bash is the standard shell on macOS and Linux. can be changed to zsh
Use
kubectl -h
if you are stuck
Kubectl can help you along the way, if you ever get stuck try using kubectl explain
to find more info about what you are working with.
Important commands for debugging include:
- explain
- describe
- log
- exec
Task 1
Use kubectl
to view the config you have been given. Look for information about the cluster, username and context
Solution
Solution: View Config
kubectl config view
Task 2
Use kubectl explain
to get some info on a resource (e.g. pod
)
Solution
Solution: View Config
kubectl explain service
- Previous
- Next