Last active
July 26, 2021 10:14
-
-
Save zycon/df2bf77c35e8d64496717d71d37d06e3 to your computer and use it in GitHub Desktop.
Kubernetes 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
### FILTER PODS | |
kubectl delete pods --field-selector=status.phase=Pending | |
### GET IMAGES | |
kubectl get pods -o jsonpath="{.items[*].spec.containers[*].image}" |tr -s '[[:space:]]' '\n' |sort |uniq -c | |
### Delete pods not running | |
kubectl get pods | grep -v Running | awk '{print $1}' | xargs kubectl delete pod | |
### Merge kubeconfig files | |
KUBECONFIG=~/.kube/config:~/.kube/new-config kubectl config view --flatten > ~/.kube/newconfig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment