Last active
September 17, 2018 15:14
-
-
Save joaoluiznaufel/0fabda29711c898b473504652afeda48 to your computer and use it in GitHub Desktop.
Kubernetes
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
##Get cluster info | |
$ kubectl cluster-info | |
##Get nodes | |
$ kubectl get nodes | |
##Get contexts (used for multiple clusters) | |
$ kubectl config get-contexts | |
##Change contexts | |
$ kubectl config use-context CONTEXT_NAME | |
#add your credentials to your kubernetes cluster | |
kubectl create clusterrolebinding cluster-admin-binding \ | |
--clusterrole cluster-admin --user $(gcloud config get-value account) | |
##set credentials for the set cluster | |
kubectl config set-credentials cluster-admin --token=bearer_token | |
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
##Create configMap using a file | |
$ kubectl create configmap game-config --from-file=docs/user-guide/configmap/kubectl | |
##Get yml from a configMap already created | |
$ kubectl get configmaps game-config -o yaml | |
##deploy a new container | |
kubectl apply -f debian.yml --context="<name of the context>" | |
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
##get pods from a context | |
kubectl get pods --context=minikube | |
##get services | |
kubectl get services | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment