-
Notifications
You must be signed in to change notification settings - Fork 310
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
Support k3s in --docker mode #3654
Comments
Hmmm....can you link to documentation on this? This is the first I've heard of this, and we do talk to the K3d team about this sort of interop from time to time. |
(In general, what we would do in this case is ask the K3s team to provide some sort of protocol for determining when K3s is in this mode, like a ConfigMap created by the cluster, and then Tilt would read this ConfigMap...so I would need to read more about how they're advertising/documenting this) |
Here's the documentation: https://rancher.com/docs/k3s/latest/en/advanced/#using-docker-as-the-container-runtime By the way, I tried to pretend that it's a |
Reproduction instructions:
|
Hmmm....those instructions are about setting up K3s on a Node. I'm not sure this is a safe or recommended way to run K3s for local development, but let me point some people in the K3s project at this issue and see what they say. We usually see people using K3d to run K3s for local development, see our instructions here: https://github.com/tilt-dev/k3d-local-registry |
Perhaps the real feature request here is being able to disable image pushing? Skaffold has a local override: https://skaffold.dev/docs/environment/local-cluster/#manual-override |
Ya, here's an overview of some of the problems with this approach: You can disable image pushing today with Tilt with custom_build(disable_push) https://docs.tilt.dev/api.html#api.custom_build I don't think we want to support a disable-push option as easy as Skaffold's. I worry that adding options for fundamentally unsafe modes leads to checkboxes that kill (see: https://limi.net/checkboxes), i.e., situations where it's way too enable a bunch of modes that interact in weird and broken ways (and in fact we've had complaints about this already w/r/t custom_build's disable_push) |
It's not ideal for local development because it pollutes the local Docker daemon, but there are valid use cases for it (like a CI environment, which is what we use it for). It has the big advantage of being very fast since builds are local, and it shaves precious seconds off the build time that would be spent pushing to and pulling from a registry.
We're building an open source project that comes with a Tiltfile. We don't want any environment-specific config in it such that it works out of the box with whatever local cluster other contributors are using. It would also mean not having any of the conveniences of using (same about
In terms of security, it makes no difference - you can easily break out of kind or k3d, they're no security boundaries. Agreed about the dangers of excess configurability, but doesn't this particular checkbox - certain clusters not requiring pushes - already exist? Why only support it for minikube and docker-desktop? What about custom minikube deployments? |
hmmm...the minikube doc above says "Most users of this driver should consider the newer Docker driver, as it is significantly easier to configure and does not require root access. The ‘none’ driver is recommended for advanced users only.", and lists issues of "Decreased security", "Decreased reliability", and "Data loss". But you say: "In terms of security, it makes no difference" - I'm having trouble reconciling this with the minikube documentation. Is there a document you're basing that on, or is this your own independent security analysis? But if you understand the security risk, I think there are two paths forward:
So I could imagine Tilt supporting a config map like:
|
minikube in Can definitely see why they declare it a dangerous feature :-) k3s, on the other hand, is explicitly designed to run directly on a host and it takes great care to namespace all of its components. Without In a different project with Bazel, we just use plain k3s for developing in a VM without any Docker daemon running. Images are loaded straight into containerd and the deployments are updated with the new hashes:
Last time I checked, "Kubernetes in Docker" tools like k3d, kind and minikube in Docker mode, have to run the kubelet in a privileged container with root privileges. Access to the k8s API means root privileges on the host. There's some work going on to get k8s running in user namespaces but it's still a work in progress: rootless-containers/usernetes#42 The only "safe" runtime is normal minikube with VMs.
Yes, that works as expected.
Sounds perfect! (and thanks for responding so quickly!) |
…diately" We used to treat this as a property of the cluster type + the container runtime. But this made it impossible to support things clusters that sometimes use your docker runtime, and sometimes do not. For examples, see: - #4587 - #3654 - #1729 - #4544 This changes the data model so that "image builds show up in the cluster" is a property of the Docker client, not of the cluster. This should be much more flexible and correct, and help us support multiple clusters. Fixes #4544
…diately" We used to treat this as a property of the cluster type + the container runtime. But this made it impossible to support clusters that sometimes use your docker runtime, and sometimes do not. For examples, see: - #4587 - #3654 - #1729 - #4544 This changes the data model so that "image builds show up in the cluster" is a property of the Docker client, not of the cluster. This should be much more flexible and correct, and help us support multiple clusters. Fixes #4544
…diately" (#4598) * docker: change how we model "image builds show up in the cluster immediately" We used to treat this as a property of the cluster type + the container runtime. But this made it impossible to support clusters that sometimes use your docker runtime, and sometimes do not. For examples, see: - #4587 - #3654 - #1729 - #4544 This changes the data model so that "image builds show up in the cluster" is a property of the Docker client, not of the cluster. This should be much more flexible and correct, and help us support multiple clusters. Fixes #4544 * Update internal/docker/env.go Co-authored-by: Maia McCormick <maia@windmill.engineering> Co-authored-by: Maia McCormick <maia@windmill.engineering>
…diately" (#4598) * docker: change how we model "image builds show up in the cluster immediately" We used to treat this as a property of the cluster type + the container runtime. But this made it impossible to support clusters that sometimes use your docker runtime, and sometimes do not. For examples, see: - #4587 - #3654 - #1729 - #4544 This changes the data model so that "image builds show up in the cluster" is a property of the Docker client, not of the cluster. This should be much more flexible and correct, and help us support multiple clusters. Fixes #4544 * Update internal/docker/env.go Co-authored-by: Maia McCormick <maia@windmill.engineering> Co-authored-by: Maia McCormick <maia@windmill.engineering>
k3s can use a local Docker daemon in
--docker
mode.This is similar to Docker for Desktop mode, where built images are immediately available in the cluster.
Currently, this isn't properly detected.
The text was updated successfully, but these errors were encountered: