Cordon all nodes.
for i in $(kubectl get nodes | grep ip |awk '{print $1}'); do kubectl cordon $i; done
Cordon all nodes.
for i in $(kubectl get nodes | grep ip |awk '{print $1}'); do kubectl cordon $i; done
Deletes a namespace stuck in terminating.
kubectl get namespace <terminating-namespace> -o json >tmp.json
Edit the json file and remove “kubernetes” from the finalizer. So your spec will look something like this.
"spec": {
"finalizers": []
},
Connect to the kube api.
kubectl proxy
Update the finalizers using the API.
curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8001/api/v1/namespaces/<terminating-namespace>/finalize
Deletes pods that are stuck in a terminating state.
kubectl delete pod --grace-period=0 --force --namespace <NAMESPACE> <PODNAME>
Creates a temporary container to troubleshoot networking within Kubernetes.
kubectl -n amazon-cloudwatch run tmp-shell --restart=Never --rm -i --tty --image nicolaka/netshoot -- /bin/bash
Uncordon all nodes.
for i in $(kubectl get nodes | grep ip |awk '{print $1}'); do kubectl uncordon $i; done