Skip to content

Instantly share code, notes, and snippets.

@geek182
Last active February 22, 2018 19:46
Show Gist options
  • Save geek182/08142d29837c1dcc1add701ea827d437 to your computer and use it in GitHub Desktop.
Save geek182/08142d29837c1dcc1add701ea827d437 to your computer and use it in GitHub Desktop.
kubernetes-survival-kit
#get logs from a spefic pod and keep reading with -f flag
kubectl logs -f pod/ghost-1-wjf6m
#Connect to a pod
kubectl exec POD-NAME --stdin --tty /bin/sh
#execute a command in container, if have more than one inside pod first will be select.
kubectl exec 123456-7890 date
#Get output from running 'date' in ruby-container from pod 123456-7890
kubectl exec 123456-7890 -c ruby-container date
#get pod details
kubectl get pod -o wide
#get service details and keep update in screen
kubectl get services --watch
#delete a deployment
kubectl delete deployment NAME-OF-DEPLOY
#Forward port to pod, useful for troubleshooting, local-port->pod-port
kubectl port-forward POD-NAME 10080:80
#Run a deployment with spefic image repository
kubectl run kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment