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 clustersappears to delete all clusters. Is there a way to selectively delete cluster entries? What about contexts?
kubectl config unset takes a dot-delimited path. You can delete cluster/context/user entries by name. E.g.
kubectl config unset users.gke_project_zone_name
kubectl config unset contexts.aws_cluster1-kubernetes
kubectl config unset clusters.foobar-bazSide 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 planned kubectl config rework for a future release to make the commands more intuitive/usable/consistent.
For clusters and contexts you can also do
kubectl config delete-cluster my-cluster
kubectl config delete-context my-cluster-contextThere's nothing specific for users though, so you still have to do
kubectl config unset users.my-cluster-adminRun command below to get all contexts you have:
$ kubectl config get-contexts
CURRENT   NAME             CLUSTER     AUTHINFO                                NAMESPACE
*         Cluster_Name_1   Cluster_1   clusterUser_resource-group_Cluster_1Delete context:
 $ kubectl config delete-context Cluster_Name_1