kubectl config view
shows contexts and clusters corresponding to clusters that I have deleted.
How can I remove those entries?
The command
kubectl config unset clusters
appears to delete all clusters. Is there a way to selectively delete cluster entries? What about contexts?
Best Answer
kubectl config unset
takes a dot-delimited path. You can delete cluster/context/user entries by name. E.g.Side note, if you teardown your cluster using
cluster/kube-down.sh
(or gcloud if you use Container Engine), it will delete the associated kubeconfig entries. There is also a plannedkubectl config
rework for a future release to make the commands more intuitive/usable/consistent.