-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to connect to kind API server when using Kind inside Kubernetes #3622
Comments
First of all: I do NOT recommend using Kubernetes inside Kubernetes (kind or otherwise) as there's a lot of confusing behavior when attempting to nest them, that said Kubernetes does for ... reasons.
This is not nearly enough information to debug. You might not be able to connect because the client isn't on the same network (note that 127.0.0.1 is local to a network namespace, so wherever the container runtime is that the kind nodes are running on), or the cluster might not be up or ... |
@BenTheElder I understand the network disparity here. I was also looking at #523 where a comment is provided(#523 (comment)). According to this looks like an IP forwarding is required. |
There's no additional forwarding because they're running any other steps in the same network namespace as the node containers. I.E. the container running dind is also running cluster-API. |
Hi @BenTheElder , I was just playing around and trying to get a workaround. So the nested docker container(kind's control plane), I could exec into it and get the /etc/kubernetes/admin.conf, but, I want to access it outside of that nested docker container, in the host container. I am not able to figure out this thing. Is there a way I can do that? Just to again clarify, this host container along with some other container are a part of a GKE cluster's pod. And I was getting this error when trying to access the nested container(kind control-plane) from the host container:
|
Wherever you ran In cluster API's CI, it looks like: host => container running dind + kind + cluster API CI scripts => kind nodes => kind pods That "just works" with the normally exported KUBECONFIG from
I can't quite tell but it sounds like your layout is more like: It's a LOT more complicated and really out of scope for us / not recommended ... you will have to either operate something like an SSH tunnel or configure the kind cluster to expose to something other than localhost (which we don't recommend for security purposes), the localhost addresses are not going to be accessible between different pods / containers. https://kind.sigs.k8s.io/docs/user/configuration/#api-server |
@BenTheElder
Yes this is what still bothers me.
Right, I get the security aspect of this. But my kubectl just denies connecting to the local address which I get in my kubeconfig. I have tried providing a config with kind too with apiServerAddress: 0.0.0.0 but that also doesn't work. |
To be clear, because If it's from |
@BenTheElder I mean |
I would start debugging from just a container with a minimal docker port forward to hello-world and see what it takes to get that working in the dind environment. |
What happened: I am creating a test setup similar to Cluster API and Providers repos where I want to run e2e cluster jobs inside test-pods using prow jobs. The test initiates by creating a kind management cluster. I am able to create a kind cluster but I am not unable to connect to this kind cluster's api server. I get a
The connection to the server 127.0.0.1:43357 was refused - did you specify the right host or port?
error. I have gone through #303 and mounted these paths and changed thednsPolicy
toDefault
but the error still persists.What you expected to happen:I expected to be able to connect to the kind cluster.
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
kind version
):v0.23.0
docker info
,podman info
ornerdctl info
):/etc/os-release
):alpine
kubectl version
):v1.30.0
The text was updated successfully, but these errors were encountered: