Skip to content

Instantly share code, notes, and snippets.

@ocristian
Last active March 26, 2021 09:07
Show Gist options
  • Save ocristian/379d1567a3ae7551cef31afb9d3fb19c to your computer and use it in GitHub Desktop.
Save ocristian/379d1567a3ae7551cef31afb9d3fb19c to your computer and use it in GitHub Desktop.
# Contexts
kcgc - kubectl config get-contexts
kcuc - kubectl config use-context [CONTEXT name]
# POD
# list pods
kgp | grep [POD]
# execute a command in a container
k exec [POD] -it -- bash
# restart pod
kubectl rollout restart "deployment/[POD]"
# delete
kubectl delete pod [POD]
# Port-forward
k port-forward [POD] local-port:remote-port
# Logs
kubetail [POD]
# Scaling
kubectl get hpa [POD]
kubectl describe hpa [POD]
kubectl edit hpa [POD]
kubectl scale deployment [POD] --replicas=0
# Deployment
kubectl describe deployment [POD]
kubectl get deployment [POD]
kubectl delete all,ingress -l "key=value"
kubectl describe ingress [resource]
# Cron Jobs
kubectl get cronjob [name]
kubectl delete cronjob [name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment