#Help running Dagger on Kuberenetes

1 messages · Page 1 of 1 (latest)

ocean moth
#

Submission from @fringe prism - moved from orgnianl post in demo forum - https://discord.com/channels/707636530424053791/1245068814589235291


I have followed the instruction on setting up dagger Engine inside, it is running but having issue connecting from the git . here is the video https://www.youtube.com/watch?v=sogSICwyg0Y . I also rwady instruction from dagger.io but could not get it working.

➜  hello-dagger git:(main) kubectl get pods -n dagger
NAME                              READY   STATUS    RESTARTS      AGE
dagger-dagger-helm-engine-4dz5t   1/1     Running   0             55m
dagger-dagger-helm-engine-5r5k2   1/1     Running   0             55m
dagger-dagger-helm-engine-tth5r   1/1     Running   0             55m
gitlab-runner-65dcb59c85-tgvp6    1/1     Running   2 (63m ago)   68m
rockylinux                        1/1     Running   0             6m57s
✗  hello-dagger git:(main) echo $env.DAGGER_ENGINE_POD_NAME
dagger-dagger-helm-engine-4dz5t
➜  hello-dagger git:(main) echo $env._EXPERIMENTAL_DAGGER_RUNNER_HOST
kube-pod://dagger-dagger-helm-engine-4dz5t?namespace=dagger

but still dagger refuse to connect

#

helm upgrade --install --namespace=dagger --create-namespace dagger oci://registry.dagger.io/dagger-helm
but i get this error,

`➜ hello-dagger git:(main) dagger init --sdk=go
● connect 0.1s
2024/05/28 11:28:30 http2: server: error reading preface from client localhost: rpc error: code = Unknown desc = failed to get client metadata for session call: failed to JSON-unmarshal x-dagger-client-metadata: json: cannot
∅ connect 14.6s
┃ Failed to connect; retrying... name:"error" value:"make request: Post "http://dagger/query\": rpc error: code = Unknown desc = failed to get client metadata for session call: failed to JSON-unmarshal x-dagger-client-metada
┃ : json: cannot unmarshal array into Go struct field ClientMetadata.labels of type telemetry.Labels"
┃ Failed to connect; retrying... name:"error" value:"make request: Post "http://dagger/query\": rpc error: code = Unknown desc = failed to get client metadata for session call: failed to JSON-unmarshal x-dagger-client-metada
┃ ta: json: cannot unmarshal array into Go struct field ClientMetadata.labels of type telemetry.Labels"
┃ Failed to connect; retrying... name:"error" value:"make request: Post "http://dagger/query\": rpc error: code = Unknown desc = failed to get client metadata for session call: failed to JSON-unmarshal x-dagger-client-metada
┃ ta: json: cannot unmarshal array into Go struct field ClientMetadata.labels of type telemetry.Labels"
┃ Failed to connect; retrying... name:"error" value:"make request: Post "http://dagger/query\": rpc error: code = Unknown desc = failed to get client metadata for session call: failed to JSON-unmarshal x-dagger-client-metada
┃ ta: json: cannot unmarshal array into Go struct field ClientMetadata.labels of type telemetry.Labels"

Error: context canceled`

#

@stiff rapids @pallid sapphire This user was watching your video https://www.youtube.com/watch?v=sogSICwyg0Y, so you might have some pointers for them.

Erik & Gerhard show you how to install Dagger on Kubernetes with one command. We then run a simple module using the local CLI against the Dagger Engine which we just deployed to Kubernetes. We then destroy some YAML 👾

🎙 Listen to the audio part at https://pod.gerhard.io/3

🎁 Access the audio & video as a single conversation at https://makeitwor...

▶ Play video
azure viper
#

Hey @fringe prism can you validate that your dagger CLI is the same version as the engine deployed in k8s?

fringe prism
#

yes they are

[root@rockylinux ~]# dagger version
dagger v0.11.5 (registry.dagger.io/engine) linux/amd64

and engine versiob number is

➜  ~/.kube/cache kubectl get ds dagger-dagger-helm-engine -n dagger -o yaml | grep version
    app.kubernetes.io/version: v0.11.5
fringe prism
azure viper
#

are you running the dagger CLI in the same machine where you have kubectl installed?

#

cc @fringe prism

#

the kube-pod scheme requires kubectl with a valid context and kubeconfig file to work

#

since it uses kubectl exec under the hood to open the connection to the engine

#

I'm asking because I see the prompt of the two snippets you shared are different

azure viper
#

is kubectl in the PATH? I see you're calling ./kubectl

fringe prism
#

in the above screenshot i am inside the rockylinux pod

fringe prism
azure viper
fringe prism
#

oh i see if i call it ./kubectl, the dagger cli would not be able to access it becauase it is not in the path.Dammit

azure viper
fringe prism
#

@azure viper please can i ask 2 more questions?

azure viper
fringe prism
#

okay thanks

DAGGER_ENGINE_POD_NAME="$(kubectl get pod \
    --selector=name=dagger-dagger-helm-engine --namespace=dagger \
    --output=jsonpath='{.items[0].metadata.name}')"
export DAGGER_ENGINE_POD_NAME

_EXPERIMENTAL_DAGGER_RUNNER_HOST="kube-pod://$DAGGER_ENGINE_POD_NAME?namespace=dagger"
export _EXPERIMENTAL_DAGGER_RUNNER_HOST

if you have 3 worker node, so you get 3 engine pods, but from the above snippet from the dagger on kubernetes only the first detected pod will be in use. does dagger cli or sdk detected the other behine the scene from that one pod name?

#

i am asking because if it was a service, i would have understood it will loadbalace between the pods, but in this case if that pod goes down, what happens next

azure viper
#

we already expose the engine socket to the host in the daemonset, the only thing you need to do is to create your pods with that socket mounted. Let me get you an example.

cc @worthy token and @stiff rapids. Just realized we're not mentioning this in our kubernetes guide: https://docs.dagger.io/integrations/104820/kubernetes

Deployment with Helm

fringe prism
#

that was my second question

#

thank you very much, now i understand it

azure viper
fringe prism
#

@azure viper thank you again