#How to access services deployed inside a Kind cluster in a Dagger container

1 messages · Page 1 of 1 (latest)

slow grove
#

Hi, I'm trying to build a CD pipeline with Dagger.

I have created a Helm chart to deploy everything (frontend, backend and database). I create a Kind cluster (configured to use ingress) inside a Dagger container to deploy de charts in it. I have an ingress per service (frontend and backend). Locally, in my machine, I can configure the /etc/hosts file to resolve the custom urls as local, but inside de container I can't because it says that the filesystem is read-only.

Even if I could config the /etc/hosts I don't know if I would be able to access it. I found that there is a Host type, but I can't make it work. It's like it doesn't exist. I do dag.Host() or dagger.Connect().Host() and it says that this function doesn't exist.

I tried port-fordwarding the frontend and backend services, but the problem is that, when I access the frontend service in my browser, this is the one who makes the call to the backend, looking for the url specified by its ingress, so it does not find it.

My repository is private because is part of my Bachelor's Thesis. If there is any need of specification about the code, I would have no problem to share it through this chat.

Is there any workaround for this?

#

How to access services deployed inside a Kind cluster in a Dagger container

toxic ravine
#

@slow grove are you using any existing module(s) to start your kind cluster? or is that all custom built?

#

also, what ingress controller are you using? nginx?

slow grove
#

I have an open PR to implement the option of including your own config file

#

That way I can use ingress

slow grove
toxic ravine
#

so, IIUC this module creates the kind cluster in your own docker daemon, correct?

slow grove
#

correct

toxic ravine
#

i.e: if you do docker ps do you see the kind containers?

slow grove
toxic ravine
#

yes, they are there

#

in that case connecting to kind it's the same as if you were running kind in your local machine without Dagger

#

Since everytying runs in your docker daemon anyways

slow grove
#

I haven't though about trying that

#

wow, okay

#

it works

#

thank you very much

toxic ravine
#

sure, np!

#

happy to help!

visual stream
#

@toxic ravine that is super interesting to know.
Not long ago I was trying doing the same, the problem I saw is that if I want to test the kind node itself it is actually in the Docker host, and the engine is probably outside this container network.

@slow grove did you schedule Pods via kubectl / kustomize from within the Dagger module itself?

slow grove
#

I have a repository for the Helm charts and other with the values as the single source of truth, with it I have a helmfile.yaml as well. So in the module I install helmfile, download everything with git, and deploy it.

#

I don't know if this answers your question @visual stream

toxic ravine
visual stream
toxic ravine
#

I wonder if the same is possible with KinD,

that's tricky because of networking. Since KinD is running on a completely different network outside Dagger, making that work will require some ugly non-portable hacks probably

visual stream
elfin pilot
#

Sorry to hijack this thread, but as you were already talking about k3s/kind in a very similar note...
How would you expose any service deployed in the k3s cluster to the host that runs the dagger call?

toxic ravine
elfin pilot
#

Thanks. I was looking at the proxy module before but wasn't convinced it was going to work as i need to bring up an empty cluster exposing services that will "eventually be deployed"

(ctx: Trying to get Tilt to use a k3s cluster ran by dagger, deploying images built by dagger into the registry available to Tilt and being able to reach the services deployed into the k3s cluster from the host network. )

#

I'll look at the proxy see if I can make that work, or get some ideas ty