Last active
March 20, 2018 12:14
-
-
Save bastman/a567f46a9830115ae8e7a5431d701929 to your computer and use it in GitHub Desktop.
k8s-commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see: https://kubernetes.io/docs/user-guide/kubectl-cheatsheet/ | |
brew upgrade kubernetes-cli | |
brew list kubectl --versions | |
brew info kubectl | |
brew switch kubectl 1.7.5 | |
# get current context | |
$ kubectl config current-context | |
# change current context | |
$ kubectl config use-context my-cluster-name | |
# run proxy and serve dashbord ui on http://127.0.0.1:8001/ui | |
$ kubectl proxy --port=8001 | |
$ curl http://localhost:8001/api/ | |
# pods | |
$ kubectl get pods | |
$ kubectl describe pod POD_NAME | |
$ kubectl exec POD_NAME -- ls | |
$ kubectl exec POD_NAME -- env | |
$ kubectl exec -it POD_NAME /bin/bash | |
$ kubectl delete pod POD_NAME --force --grace-period=0 | |
# nodes | |
$ kubectl describe nodes | |
# secrets (must be base64 encoded) | |
# example secret-value: ABC!DEF (to be base64 encoded) | |
# base64 encode (remove newlines, escape special chars) | |
$ echo -n ABC\!DEF | base64 # returns: QUJDIURFRg== | |
$ echo QUJDIURFRg== | base64 --decode # returns: ABC!DEF | |
# docker image (bash endless loop) | |
image: IMAGE_NAME | |
command: [ "/bin/bash", "-c", "--" ] | |
args: [ "while true; do sleep 30; done;" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment