Last active
August 21, 2019 08:11
-
-
Save adixchen/1dde14ea4332f2175d1a723ca4479712 to your computer and use it in GitHub Desktop.
kubernetes useful commands
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
# install and delete keycloak helm chart | |
## install | |
cd /Users/maad4/projects/training/codecentric-helm-charts/charts/keycloak; | |
helm install --name keycloak . | |
## delete | |
helm delete --purge keycloak | |
# secrets | |
## create cloudsql-instance-credentials secret | |
kubectl create secret generic cloudsql-instance-credentials --from-file=credentials.json | |
## keycloak-db | |
kubectl create secret generic keycloak-db --from-literal=password=PWD | |
kubectl create secret generic keycloak-admin --from-literal=password=PWD | |
kubectl delete secret keycloak-db | |
# logs | |
## show tail of keycloak logs | |
kubectl logs pods/keycloak-0 keycloak -f | |
#config | |
## To view your environment's kubeconfig, run the following command: | |
kubectl config view | |
## show contexts | |
kubectl config get-contexts | |
##To view the current context for kubectl, run the following command: | |
kubectl config current-context | |
## set context | |
kubectl config use-context CONTEXT_NAME #CONTEXT_NAME from the list above | |
## show namespaces | |
kubectl get namespaces | |
## set "namespace" in context | |
kubectl config set-context $(kubectl config current-context) --namespace=dev | |
# ingress | |
## get ingress resources | |
kubectl get ingress | |
## get ingress description | |
kubectl describe ingress ingress-name # where ingress-name you can take from the previous command | |
# get a shell running inside k8s | |
kubectl get pods # list the pod names | |
kubectl exec -it POD_NAME -- /bin/bash | |
kubectl exec -it POD_NAME -- /bin/sh # for alpine | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment