Connection refused to self-hosted gitlab

I’m trying to connect the kubernetes cluster to my self-hosted gitlab using this command:

helm repo add gitlab https://charts.gitlab.io
helm repo update
helm upgrade --install my gitlab/gitlab-agent
–namespace gitlab-agent-my
–create-namespace \
–set image.tag=v16.10.1
–set config.token= \
–set config.kasAddress=wss://gitlab.my.com/-/kubernetes-agent/

But connection status of agent stay "Never connected’
I try to view the service logs

kubectl logs -f -l=app.kubernetes.io/name=gitlab-agent -n gitlab-agent-my

{“level”:“error”,“time”:“2024-05-17T19:24:23.780Z”,“msg”:“Failed to register agent pod. Please make sure the agent version matches the server version”,“mod_name”:“agent_registrar”,“error”:“rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: failed to WebSocket dial: failed to send handshake request: Get \"https://gitlab.xxx.com/-/kubernetes-agent/\\\”: dial tcp: lookup gitlab.xxx.com on 10.96.0.10:53: read udp 10.85.0.18:39803->10.96.0.10:53: read: connection refused""}

I hosted my gitlab using nginx reverse proxy.

.conf file looks like this:

server {

listen  443 ssl;
server_name gitlab.xxx.com;
ssl    on;
include ssl.conf

location / {
     proxy_pass https://192.168.8.111;
}

location /-/kubernetes-agent/ {
    proxy_pass https://192.168.8.111;
}

}

How can I fix this?

Thanks in advance for your answer!

This means the agent Pod cannot resolve the server’s address because it cannot connect to the DNS server.

3 Likes