Last active
April 17, 2020 04:52
-
-
Save madsonic/5fa062425de67a5946926e770b86698d to your computer and use it in GitHub Desktop.
Cheat sheet related to k8/docker/helm and other related technologies
This file contains 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
# long | |
docker run --rm -ti \ | |
--publish <container port>:<exposed port> \ | |
--env <env>=<val> \ | |
--volume <local path>:<mounted path> \ | |
<repo>/<image>:<tag> | |
# short | |
docker run --rm -ti \ | |
-p <container port>:<exposed port> \ | |
[-e <env>=<val> | --env-file <list of files>] \ | |
-v <local path>:<mounted path> \ | |
<repo>/<image>:<tag> | |
# existing container | |
docker exec -ti container_name sh | |
# Runs a one time container in your kubernetes cluster | |
# long form | |
kubectl run --tty --stdin --rm --restart Never --namespace <namespace> --image=<your-image> sh | |
# short form | |
kubectl run -ti --rm --restart Never -n <namespace> --image=<your-image> sh | |
# existing container, works like a ssh | |
kubectl exec -n <namespace> -ti -c <container> <pod> -- /bin/bash |
This file contains 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
# set current context to use given namespace | |
# instead of doing kubectl -n namespace all the time | |
kubectl config set-context --current --namespace="yournamespace" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment