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
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://

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

kubectl logs -f -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 \"\\\”: dial tcp: lookup on read udp> read: connection refused""}

I hosted my gitlab using nginx reverse proxy.

.conf file looks like this:

server {

listen  443 ssl;
ssl    on;
include ssl.conf

location / {

location /-/kubernetes-agent/ {


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.