$ kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://kubernetes.docker.internal:6443
name: docker-desktop
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://192.168.100.10:6443
name: kubernetes
contexts:
- context:
cluster: docker-desktop
user: docker-desktop
name: docker-desktop
- context:
cluster: docker-desktop
user: docker-desktop
name: docker-for-desktop
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: docker-desktop
kind: Config
preferences: {}
users:
- name: docker-desktop
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
- name: kubernetes-admin
user:
client-certificate-data: REDACTED
client-key-data: REDACTED
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
docker-desktop docker-desktop docker-desktop
docker-for-desktop docker-desktop docker-desktop
* kubernetes-admin@kubernetes kubernetes kubernetes-admin
$ kubectl config current-context
docker-desktop
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* docker-desktop docker-desktop docker-desktop
erase-una-vez-k8s kubernetes kubernetes-admin
$ kubectl config use-context erase-una-vez-k8s
Switched to context "erase-una-vez-k8s".
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
docker-desktop docker-desktop docker-desktop
* erase-una-vez-k8s kubernetes kubernetes-admin
$ kubectl config delete-context docker-for-desktop
deleted context docker-for-desktop from /Users/rodolfo/.kube/config
$ kubectl config unset contexts.[CONTEXT NAME]
$ kubectl config rename-context kubernetes-admin@kubernetes erase-una-vez-k8s
Context "kubernetes-admin@kubernetes" renamed to "erase-una-vez-k8s".