-
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
Provide kind docker image to support docker-compose setup #706
Comments
This doesn't really map particularly well to how kind works. We need to execute logic against node containers to orchestrate the cluster. We can still run kind this way in a container if we put another layer of docker in docker and run a whole cluster inside there but then you need some mounts etc. That makes this clunky, slower, and less reliable. We're going to document how you'd go about that in a pod (tracked in another issue) which is pretty similar because we do it and need it, but I'm not sure we'd want to recommend it or try to provide a special image for it. You can achieve this yourself today with a docker in docker image + the kind binary, which is pretty trivial to create. The rest is customizing how you want kind to run / cluster configuration, cleanup handling, possibly preloading the node image you use, timeouts for docker start / stop, logging, etc. which is going to be use-case specific. Setting up kind across different CI providers and locally is pretty trivial today fwiw, but we normally leave setting up docker for kind to use and downloading / running the kind CLI to you. https://github.com/kind-ci/examples |
Thanks for the explanation. I started trying to make this work inside a docker container. I tried 2 different scenarios:
It seems this issue has been discussed before in #566. What options do I have left? |
Note that docker in docker require some special attention including:
For 2. it is possible to patch the kubeadm config to specify which hosts to sign the cert for, something like: kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
kubeadmConfigPatchesJson6902:
- group: kubeadm.k8s.io
version: v1beta2
kind: ClusterConfiguration
patch: |
- op: add
path: /apiServer/certSANs/-
value: my-hostname-to-add |
Hey @BenTheElder, I'd like to revisit the kind use case inside a container. I saw #706 but I'm not quite sure I understand the required paths for making it work. Are you saying mounting Also, what's the path for docker storage? |
The latter is a requirement if you're adding another layer on top of kind. The former is also useful.
There's no native docker on Mac, it will get those mounts from the host VM.
That's configurable. You're looking for the docker data root.
Wherever the container filesystems will be mounted cannot also be a container filesystem. |
Note that aside from the modules which some Kubernetes related tooling will inspect, the rest of those are entirely about "nesting" containers and have no particular significance to kind. |
gcr.io/k8s-testimages/krte is what kind uses in CI We'll probably install the stable kind binary in it soon, however this is at most semi official, and this isn't a pattern I recommend. Ideally test setups come from the https:/)github.com/kind-ci/examples repo, we link to this in the docs and are consolidating things used for third party CI platforms there. The Kubernetes project does not use or support most of these, so that location adjacent is a little more appropriate (and easier to enable eg Travis) |
to be clear the KRTE image contains these things, you can find the sources in https://github.com/kubernetes/test-infra/ |
@BenTheElder it makes sense. I'll have a look at those. Thanks! |
@gerardo , did you end up finding a way to get this to work? Trying to do the same at the moment :d I copied more or less what you did in the airflow commit here: apache/airflow#5837 But it doesn't seem to work for me. I get: The connection to the server localhost:8080 was refused - did you specify the right host or port? |
This would be great to have so that it can work on docker native CIs like GitLab CI... |
Yep, having a kind Docker image which one could just use as a GitLab service would be great. |
Trying to configure a pre-packaged dev environment for my monorepo complete with necessary infrastructure services (db, redis, etc) in a docker-compose file and it would be ideal to also include a k8s cluster service in there to make it easier to onboard new team members and it would reflect a final production environment somewhat where you have external IaaS components being accessed from within your cloud k8s cluster. It makes total sense. If anyone has a working example they can link to that would be amazing. |
We have a contrib repo with CI examples here https://kind.sigs.k8s.io/docs/user/resources/#using-kind-in-ci PRs welcome. |
What would you like to be added:
It would be great if kind could be provided as a docker image, so that it could be used as an extra service through docker compose. Ideally a docker-compose setup using a hypothetical
kind
image would look like this:After running
docker-compose run mycontainer bash
(to get a shell from inside my container while having the other container services available in the samebridge
network), you should be able to connect to kubernetes using the host namekubernetes
.Why is this needed:
Some use cases:
Similar:
The text was updated successfully, but these errors were encountered: