-
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
Cannot talk to cluster inside dind container #52
Comments
Hmm, we're running kind in our DIND setup, I've not tried it in this particular fashion yet though. |
er if I'm reading this correctly, you installed a new version of docker after starting a dind container? that seems like a bad idea. investigating locally with a dind container edit: nevermind, reread that 🙃 |
So the problem here appears to be is the network connection from your linked container to kind, the cluster is actually running but you can't talk to it, since it's actually running over in the In our CI we do it like:
But with your setup it appears to be more like:
Would it be possible for you to avoid the |
So I am using |
Thanks, taking a look. This job runs When you run in the docker executor, are you running everything with the dind container, or are you running the dind container alongside another container there as well? |
I think the docker executor is actually a thin layer over kubernetes, cc @munnerz who I believe was involved here... edit: nope, but it has very similar config, we can mount the volumes if necessary but they shouldn't strictly be necessary It looks like we can mimic our pod setup if needed, per: One of our actual pods looks like this: https://storage.googleapis.com/kubernetes-jenkins/logs/ci-kubernetes-kind-conformance/508/artifacts/prow_podspec.yaml |
So currently I run dind as a service container, and then I have my main container in which I would like to run my tests on the kubernetes cluster. I have done this setup in the past for using regular Docker images/containers and it works well. |
Have you done it while talking to a networked service running over in the dind container before? We should just need to fix up:
I can't tell from these details what that address is though, but given what you've shown and local replication of this setup as best as I can tell, otherwise things should be working fine. |
Oh, I remember. I think I had issues with that in the past. The issue was that from outside, I can see only the dind container, and not any network behind it. So I had to publish ports in Docker containers running through dind, so that they got available on the dind container. So dind container is like host, and you do not have access directly to containers behind. Which might be also additional problem for me because I want to run then pods on the cluster, which again might not be available from my testing container, because it would again be behind dind container/host. |
Yes exactly, it may be possible to forward ports from the dind container but it might be tricky to manage, and we'd need to possibly add some small feature to kind to inform it of the expected address instead of localhost. Alternatively, if you can run your other code + If we can get to the "kubernetes API server is forwarded through dind, and we've told |
OK. So I do not know about gitlab.com CI, but on our private GitLab instance I discovered that it seems I am given
So I just install kind and kubectl and then test it out. Sadly, it still does not work but I think this is closer. The output of final commands is is as follows:
So you see that |
I think you just need your second container to use |
from within a and proceeded to install docker + kubectl, copy the kind config over from the other container, etc., and I can talk to the cluster, listing pods etc. |
Also:
Absolutely! Any dind solution should be a major security concern, including this one. Please be careful.
I of course also run |
Hm, running with
But I am guessing certificates do not match? I still get connection refused. How can I be sure that the other container really runs properly? I can ping it now from my container. I did nmap port scan and only port 10250/tcp is open on the container. |
Are you sure The certificates may not match if you use another address, when kind inits kubernetes it requests |
So currently I am not using dind anymore, but Docker socket from the host. So the container in which I am already runs. I could try to create another container inside and then go inside it and so on, but to me it looks like the issue is somewhere else because the container runs and I can ping it (it is jut not on localhost), but no ports besides 10250 are open in the container. |
There should be one randomly allocated port (allocated by docker) open on the container forwarding to the secure API server port (6443), and the exported kubeconfig will match If you run something in an nested container that container ideally needs to use EDIT: adjacent -> nested. for adjacent we just want to use the actual node container IP, which is actually in the default config, when we export the config to the host we rewrite this to match the forwarded port. I'm thinking about ways we could better expose that... |
So something else is wrong. So I am connecting directly to the container, bypassing Docker port mapping. Connecting to 6443 does not work. 10250 is port on which kubelet is listening. But why there are no other things running correctly in the container. |
I managed to get it working with the following:
So instead of using host's Docker socket, I do simply a proper dind inside my container. |
Awesome! If you use kind with defaults this should continue to work as is for the foreseeable future. The config is not yet stable (PR #36) and logging etc needs work. I'll be stabilizing it and looking into multinode this quarter though, we intend to use it for more CI ourselves. :-) Please let me know if you have any more feedback or issues. I know user and development guides are very high on my list currently besides UX and stability fixes. |
So while I was able to make this work, it would be great if this would work also no gitlab.com. It would be useful to try it there as well. |
And thanks for all this work and thank you for all the help. |
OK, as a note to my future self and others. I had issues running Docker inside my own privileged container so that I could run kind inside, and the reason was that I wanted to use |
Yes exactly, I tried to mention this above but failed I think. Doing that has worked flawlessly for dind in our CI at least. overlay fs don't stack, but it works fine if you just make sure the docker graph I'll be sure to add this to the docs soon! |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
After fixing the cluster name issue from #619 I think I hit the same issue.
I am not so sure to understand in which container Since this issue is quite old now is there some bits of docs about that? |
@TheErk to run docker in docker that path must be a volume in the container you run docker in. There are no docs for this because we don't have any gitlab CI and nobody has contributed any 😅 As mentioned previously, any contributions tohttps://github.com/kind-ci/examples would also be extremely welcome, we aim to eventually have starter configs etc. for use everywhere.. |
xref: #620 (comment) |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I've had success running kind with the docker:dind service by using the Networking section of the config, e.g. setting Using something like
Example:
See my full setup here: https://gitlab.com/ViDA-NYU/reproserver/commit/4e9e8adfca37ca091e5c02ad3a3b070736e3b0ec |
SOLUTION:
Note:
|
FYI for future folks finding this issue we now have a contrib repo https://kind.sigs.k8s.io/docs/user/resources/#using-kind-in-ci that documents CI setups such as this. |
I think this is covered there now. See also perhaps #303. |
Removing the old kind binary install since .11 is released and kube-p…
…ble_iam_avoid_creation [EOS-11007] No ejecutar el paso de "IAM security" si se indica --avoid-creation
I am trying to use it on GitLab CI which uses DIND. I am trying to setup cluster inside a Docker container. I have tried the following:
Inside container:
The text was updated successfully, but these errors were encountered: