Search code examples
dockerkubernetesdocker-desktop

Docker Desktop Mac unable to access Kubernetes


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:

screen

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!


Solution

  • The issue was with wrong permissions was set on my /usr/local/bin directory, which prevented Docker Desktop to work correctly.

    chmod +xr /usr/local/bin
    

    resolved this issue.