Skip to content

Instantly share code, notes, and snippets.

@sleeyax
Last active May 7, 2022 00:19
Show Gist options
  • Save sleeyax/4a08bf411a8e01d7be229cf336ad8c7b to your computer and use it in GitHub Desktop.
Save sleeyax/4a08bf411a8e01d7be229cf336ad8c7b to your computer and use it in GitHub Desktop.
Super useful kubernetes commands

Kubernetes commands

Edit an existing secret using an external env file

kubectl create secret generic <secret-name> --from-env-file=.env.prod --dry-run -o yaml | kubectl apply -f -

Copy secret from one namespace to another

kubectl get secret mysecret --namespace=default --export -o yaml | kubectl apply --namespace=dev -f -

Delete all evicted pods

kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment