Hi all, I’m wondering if I’m missing something tri...
# k3d
m
Hi all, I’m wondering if I’m missing something trivial like a flag or a config switch somewhere. I would like to connect
kubectl
running from a separate Docker container over to a cluster created by k3d. For context, I’m using Rancher Desktop on a MacBook Pro, and run
k3d cluster create <name> --no-lb
to bring up the cluster with one server container only. The other container is run up with
docker run --interactive --network <cluster network> --rm --tty --volume "$HOME/.kube:/root/.kube:ro" <image tag> /bin/bash
. From a terminal on my machine outside of any containers,
curl --insecure <https://0.0.0.0>:<random k3d port>
gives an expected 401 unauthorised JSON response from the cluster, but the same
curl ...
from inside my separate Docker container gives
curl: (7) Failed to connect to 0.0.0.0 port 65168 after 0 ms: Couldn't connect to server
. Same with `kubectl version`; from outside I see
Server Version: v1.31.5+k3s1
but from inside the other container I see
The connection to the server 0.0.0.0:65168 was refused - did you specify the right host or port?
. I have my kubeconfig file mounted through into the container so the config is all there, but I guess I’m missing some more network plumbing somewhere? Do I need to update the
0.0.0.0
address that is set inside the kubeconfig? Thanks in advance for any notes! 🙏
w
Hey! When connecting from another container, try using port 6443 instead of the random port.
And 0.0.0.0 should be replaced with the IP or name of the server container
m
That worked a treat, thank you @wide-garage-9465 🙇
👍 1