# kubectl get pods No resources found in default namespace.
However the cluster is accessible only from the same machine since the cluster is listening on 127.0.0.1:6443 . As a workaround to allow remote connections a port proxy can be added. Use elevated command prompt and execute following command:
# netsh interface portproxy add v4tov4 listenaddress=192.168.0.42 listenport=6443 connectaddress=127.0.0.1 connectport=6443 protocol=tcpIt is important to replace the 192.168.0.42 with the machine IP address. Using 0.0.0.0 prevents the cluster from starting, so the specific IP address should be used.
Next step is to add a firewall rule that allows all connections to port 6443. Open elevated PowerShell and execute:
New-NetFirewallRule -DisplayName 'Docker Desktop Kubernetes cluster on 6443' -Profile 'Private' -Direction Inbound -Action Allow -Protocol TCP -LocalPort 6443
Copy the content of the %HOMEPATH%\.kube\config file to the remote machine and modify the host from "kubernetes.docker.internal" to "vm.docker.internal" and any occurance of the text "docker-desktop" to "remote-docker-desktop".
The final version of the config file should look like:
apiVersion: v1 clusters: - cluster: certificate-authority-data: xxxxxx server: https://vm.docker.internal:6443 name: remote-docker-desktop contexts: - context: cluster: remote-docker-desktop user: remote-docker-desktop name: remote-docker-desktop current-context: docker-desktop kind: Config preferences: {} users: - name: remote-docker-desktop user: client-certificate-data: yyyyy client-key-data: zzzz
On the remote machine add "vm.docker.internal" to the /etc/hosts file
192.168.0.42 vm.docker.internalNow executing kubectl command on the remote machine should succeed.
# kubectl get pods No resources found in default namespace.