Difference between revisions of "Kubectl"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
kubectl run my-testshell --rm -i --tty --image ubuntu -- bash | kubectl run my-testshell --rm -i --tty --image ubuntu -- bash | ||
``` | ``` | ||
+ | |||
+ | |||
+ | ``` | ||
+ | kubectl delete pods --field-selector status.phase=Failed --all-namespaces | ||
+ | |||
+ | ``` | ||
+ | https://gist.github.com/zparnold/0e72d7d3563da2704b900e3b953a8229 | ||
+ | |||
# On Microk8s Quick | # On Microk8s Quick |
Revision as of 11:32, 29 April 2022
kubectl run my-testshell --rm -i --tty --image ubuntu -- bash
kubectl delete pods --field-selector status.phase=Failed --all-namespaces
https://gist.github.com/zparnold/0e72d7d3563da2704b900e3b953a8229
On Microk8s Quick
mkdir $HOME/.kube microk8s config > $HOME/.kube/config snap install kubectl --classic kubectl get nodes
or alias
alias kubectl='sudo microk8s.kubectl' alias k='sudo microk8s.kubectl'
clean-up non-running/evicted/ContainerStatusUnknown pods in example namespace
for i in $(kubectl -n zabbix-prod get pods --no-headers | grep -v "Run" | awk '{print $1}'); do kubectl -n example delete pod $i; done