Skip to content

Instantly share code, notes, and snippets.

@joaoluiznaufel
Last active September 17, 2018 15:14
Show Gist options
  • Save joaoluiznaufel/0fabda29711c898b473504652afeda48 to your computer and use it in GitHub Desktop.
Save joaoluiznaufel/0fabda29711c898b473504652afeda48 to your computer and use it in GitHub Desktop.
Kubernetes
##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
##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>"
##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