Skip to content

Instantly share code, notes, and snippets.

@toksdotdev
Last active July 30, 2021 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toksdotdev/01147e812d9b2298f5e5b95bd8769918 to your computer and use it in GitHub Desktop.
Save toksdotdev/01147e812d9b2298f5e5b95bd8769918 to your computer and use it in GitHub Desktop.
Useful Kubernetes utils
# Scale deployments
DEPLOYMENT=traefik
NAMESPACE=kube-system
kubectl scale deploy $DEPLOYMENT --replicas=0 -n $NAMESPACE
# Fetch k8s secret for any namespace (you must be authorized to fetch the secet)
SERVICE_NAME=whoami
NAMESPACE=kube-system
kubectl get secret $SERVICE_NAME-secrets -n $NAMESPACE -o go-template='{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment