Reputation: 1683
I setup Kubernetes in Docker Desktop with WSL2
Everything was working until I tried to setup a new context for GCloud. That setup was too fragile locally, so now I'm trying to reset config back to only the docker-desktop
context
I used the cli to remove the context, which didn't take it out of Docker Desktop (DD), so I uninstalled and reinstalled DD, which also didn't remove it.
In WSL2 I tried to force a full reinstall by deleting ~/.kube
and reinstalling DD in Windows (bad mistake)
This has left everything broken.
How do I fully reset/reinstall Docker Desktop & Kubernetes, forcing a reinstall inside WSL2 as well, or is there a command like init kubectl
?
Is there a way to get the standard version of the .kube/config file
that I can use to reset things myself?
mike@Mike:~$ kubectl version
Client Version: v1.31.4
Kustomize Version: v5.4.2
The connection to the server localhost:8080 was refused - did you specify the right host or port?
mike@Mike:~/.kube$ kubectl get pods
E0225 19:56:34.345048 1347 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp 127.0.0.1:8080: connect: connection refused"
E0225 19:56:34.346521 1347 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp 127.0.0.1:8080: connect: connection refused"
E0225 19:56:34.347936 1347 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp 127.0.0.1:8080: connect: connection refused"
E0225 19:56:34.349328 1347 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp 127.0.0.1:8080: connect: connection refused"
E0225 19:56:34.350654 1347 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp 127.0.0.1:8080: connect: connection refused"
The connection to the server localhost:8080 was refused - did you specify the right host or port?
~/.kube/config
apiVersion: v1
clusters: null
contexts:
- context:
cluster: ""
user: ""
name: docker-desktop
current-context: ""
kind: Config
preferences: {}
users: null
Upvotes: 0
Views: 94
Reputation: 3250
To fully reset/reinstall Docker Desktop & Kubernetes, forcing a reinstall inside WSL2
Select the Docker menu and then Troubleshoot option.
Select the Troubleshoot icon near the top-right corner of Docker Dashboard.
Choose Reset to factory defaults option to reset all options on Docker Desktop to their initial state, the same as when Docker Desktop was first installed.
To get the standard version of the .kube/config
file follow the below steps:
Open the Docker Desktop Dashboard and go to Settings.
Select the Kubernetes tab.
Toggle on Enable Kubernetes.
Click on Apply & Restart to save the settings.
This will regenerate the .kube/config
file with default settings. You can also run the below command to get the standard version.
$ Kubectl config init
Refer to this document on Deploy kubernetes with docker desktop for more detailed information.
Upvotes: 0