-
Notifications
You must be signed in to change notification settings - Fork 1
Kubectl CheatSheet
The following are examples of the kubectl
commands used throughout the workshop lessons. Remember that in the case where a resource/manifest is named directly, you should substitute the real one from your machine when you run the command.
Most kubectl
commands take this basic form:
kubectl VERB [RESOURCE] [FLAGS] [ARGUMENTS]
For further help with basic usage, just run kubectl
with no arguments
to see a listing of various available commands.
Creating/updating a resource with apply
kubectl apply -f _deployments/redis/pod.yml
List a resource
kubectl get pods
Show detail for a resource
kubectl describe pod dumbstore-web-xyz
Delete a resource
kubectl delete pod dumbstore-web-xyz
Delete resources by label
kubectl delete pod,service -l app=dumbstore
View recent log lines
kubectl logs POD_NAME
Tail a log
kubectl logs -f POD_NAME
Show rollout status for a deployment
kubectl rollout status deployment dumbstore-web
Show rollout history for a deployment
kubectl rollout history deployment dumbstore-web
Set a container image on a Deployment's Pod (triggering a new rollout)
kubectl set image deployment dumbstore-web dumbstore-web=dumbstore:1.1.0 --record
Scale up a Deployment to a different number of Pods
kubectl scale deployment dumbstore-web --replicas=5