If you manage it everyday - add this to your .basrc
or .bash_profile
or cloud-console. If not then all k
in this cheatsheet means kubectl
alias k="kubectl"
k exec -it pod-name sh
k exec -it pod-name --container container-name sh
# k port-forward pod-name local-port:remote-port
k port-forward pod-name 6379:6379
# k port forward port
k port-forward pod-name 8000
# Delete a pod using the type and name specified in pod.json.
k delete -f ./pod.json
# Delete pods and services with same names "baz" and "foo"
k delete pod,service baz foo
# Delete pods and services with label name=myLabel.
k delete pods,services -l name=myLabel
# Delete a pod with UID 1234-56-7890-234234-456456.
k delete pod 1234-56-7890-234234-456456
# Delete all pods
k delete pods --all
k cp file pod-name:~/
# view log snapshot from a pod
k logs pod-name
# Begin streaming the logs
kubectl logs -f pod-name
# tail N number
k logs --tail=20 pod-name
# tail since N time
k logs --since=1h pod-name