Skip to content
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

Can't start tilt with multi node minikube clusters using docker driver #4544

Closed
code-merc opened this issue May 11, 2021 · 10 comments · Fixed by #4598
Closed

Can't start tilt with multi node minikube clusters using docker driver #4544

code-merc opened this issue May 11, 2021 · 10 comments · Fixed by #4598
Labels
bug Something isn't working

Comments

@code-merc
Copy link

Expected Behavior

Running tilt up should work with a multi node cluster

Current Behavior

tilt up executes, but the tilt web interface logs that the tiltfile could not be executed with this error

Failed to connect to Docker: Could not read docker env from minikube.
Did you forget to run `minikube start`?
X Exiting due to ENV_MULTINODE_CONFLICT: The docker-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/

Steps to Reproduce

  1. Create a minikube cluster like this minikube start --driver=docker --nodes=2 --addons=default-storageclass,registry,storage-provisioner
  2. Run tilt up
  3. See problem above

Context

tilt doctor Output

$ tilt doctor
Tilt: v0.20.0, built 2021-04-30
System: linux-amd64
---
Docker (cluster)
- Host: Error: Could not read docker env from minikube.
Did you forget to run `minikube start`?
X Exiting due to ENV_MULTINODE_CONFLICT: The docker-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/

---
Docker (local)
- Host: [default]
- Version: 1.40
- Builder: 2
---
Kubernetes
- Env: minikube
- Context: minikube
- Cluster Name: minikube
- Namespace: default
- Container Runtime: docker
- Version: v1.20.2
- Cluster Local Registry: none
---

I think the issue is here, running minikube docker-env on a multi node cluster with the docker driver fails with

❌  Exiting due to ENV_MULTINODE_CONFLICT: The docker-env command is incompatible with multi-node clusters. Use the 'registry' add-on: https://minikube.sigs.k8s.io/docs/handbook/registry/

Enabling/disabling the registry addon doesn't make a difference either.

@code-merc code-merc added the bug Something isn't working label May 11, 2021
@nicks
Copy link
Member

nicks commented May 11, 2021

Thanks for the report!

Ya, if you just need a quick workaround, you can set up a registry as described here:
https://minikube.sigs.k8s.io/docs/handbook/registry/#enabling-insecure-registries

and then you can apply a configmap to tell tilt how to find it, like so:

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: local-registry-hosting
  namespace: kube-public
data:
  localRegistryHosting.v1: |
    host: "localhost:5000"
EOF

(we should probably ask minikube to add this to their guide, since it's in the other cluster guides: https://kind.sigs.k8s.io/docs/user/local-registry/#create-a-cluster-and-registry)

We maintain a tool called ctlptl that tries to do some of this wiring for you https://github.com/tilt-dev/ctlptl but it doesn't have an api for multi-node clusters yet

@code-merc
Copy link
Author

So we currently set up our registry using that documentation, only thing I haven't done is patch the containerd runtime but it seems like the registry plugin in minikube does that for you. Looks like the issue is with tilt is still trying to get info about the minikube cluster by running minikube docker-env regardless of the registry setup, which will always fail on a multi node cluster.

Currently what we're doing is running the minikube registry addon, forwarding to it with either with kubectl or

docker run --rm -it --network=host alpine ash -c "apk add socat && socat TCP-LISTEN:5000,reuseaddr,fork TCP:$(minikube ip):5000"

This works just fine if I set --nodes=1 in minikube start but once I change it to 2 tilt won't continue execution of the tiltfile.

Unfortunately we have a requirement to use cilium, and we were running into some odd issues using ctlptl, cilium, and a multi node kind cluster so we decided to use minikube instead and manually configure the registry.

@code-merc
Copy link
Author

Also, I tried applying that configmap and I still run into the issue

@nicks
Copy link
Member

nicks commented May 11, 2021

are you able to use minikube --container-runtime=containerd? that will turn off the docker-env entirely in minikube, so tilt won't try to connect to it

(edit: if you're using a multi-node cluster, there's no real benefit to using docker as the container runtime over containerd - docker is just "containerd + an image builder you can connect to" but you can't use that builder anyway)

@code-merc
Copy link
Author

code-merc commented May 11, 2021

Using

minikube start --cni=cilium --driver=docker --nodes=2 --container-runtime=containerd --addons=default-storageclass,registry,storage-provisioner

seems to let tilt start and push images to the registry, but pods are failing with

Failed to pull image "localhost:5000/example-html-image:tilt-ac72080bbe84db77": rpc error: code = Unknown desc = failed to pull and unpack image "localhost:5000/example-html-image:tilt-ac72080bbe84db77": failed to resolve reference "localhost:5000/example-html-image:tilt-ac72080bbe84db77": failed to do request: Head http://localhost:5000/v2/example-html-image/manifests/tilt-ac72080bbe84db77: dial tcp 127.0.0.1:5000: connect: connection refused

Using docker and a single node + cilium that setup works fine, so seems like containerd and cilium aren't playing nice unfortunately.

(edit: let me see if multinode docker has any issues with local registries, I didn't actually confirm that)

@code-merc
Copy link
Author

Ok looks like there's that same issue with just docker, I'll try disabling cilium and see if there's still an issue

@code-merc
Copy link
Author

Alright looks like cilium likes to absolutely destroy my local docker networking, not sure what that's about but unrelated to tilt. After disabling cilium and using containerd, minikube works fine with multiple nodes. I can close this unless you want to leave it open for docs/a warning message when minikube docker-env fails.

@nicks
Copy link
Member

nicks commented May 11, 2021

ya, let's leave it open for the ENV_MULTINODE_CONFLICT issue, which we should fix either way.

wiring up a registry definitely has some land mines 😬

@code-merc
Copy link
Author

By the way this same issue comes up when running with a VM driver so minikube start --driver=kvm2 --nodes=2 --addons=default-storageclass,registry,storage-provisioner causes tilt to error the same as with docker.

nicks added a commit that referenced this issue May 27, 2021
…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
nicks added a commit that referenced this issue May 27, 2021
…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
nicks added a commit that referenced this issue Jun 7, 2021
…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>
landism pushed a commit that referenced this issue Jun 9, 2021
…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>
@nicks
Copy link
Member

nicks commented Jun 10, 2021

this should be fixed in 0.20.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants