I enabled Kubernetes option in Docker Desktop v4.18 for Mac and trying to access it. According to Docker Dashboard, it started successfully, but “Kubernetes” menu item is still inactive in Docker:
When I do kubectl cluster-info
I get:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
This error usually points on error with Kubernetes’s config file missing. My guess was confirmed with: kubectl config view
, which prodiced empty result:
apiVersion: v1
clusters: null
contexts: null
current-context: ""
kind: Config
preferences: {}
users: null
I checked that config file still resides at my user folder -> “.kube/config” and looks valid:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: %INFO SKIPPED%
server: https://127.0.0.1:6443
name: docker-desktop
contexts:
- context:
cluster: docker-desktop
user: docker-desktop
name: docker-desktop
current-context: docker-desktop
kind: Config
preferences: {}
users:
- name: docker-desktop
user:
client-certificate-data: %INFO SKIPPED%
client-key-data: %INFO SKIPPED%
According to advices from here, I set environment variable, which made the things working until reboot:
terminal -> export KUBECONFIG=/Users/Rage/.kube/config
, so now I’m getting valid info via kubectl cluster-info
till the reboot.
So what do I need to repair in Docker Desktop or in Kubernate’s instance here to make it working?
I tried to ‘enable/disable Kubernates’ option in Docker Desktop itself, ‘Reset Kubernetes cluster’, ‘reset’ all in Docker and fully uninstall, reboot and then install Docker again. Without success I might add.
If you had experience overcoming this issue, please share you thoughts about it.
Thanks!
2
Answers
The issue was with wrong permissions was set on my /usr/local/bin directory, which prevented Docker Desktop to work correctly.
resolved this issue.
According to Denver Peterson,
Resetting to factory defaults did finally resolve the issue for me.
Select Troubleshoot from the drop down menu or preferences and click the bug.
Then select Reset to factory defaults.
Obviously this is a destructive solution, so use with care.
In addition to this concern, there was a solution as well provided by freedev,
stop docker for desktop
remove the folder
start docker for destkop
Found the solution here
I’ll be adding a reference to this concern for an additional fix to the issue.