Help with gitlab agent not connecting to KAS (self-hosted)

I have this weird issue that after I upgraded my gitlab I can’t get the gitlab-agent on kubernetes to connect to my KAS.

The kas logs shows:

2023-06-22_21:40:25.05914 {“level”:“error”,“time”:“2023-06-22T21:40:25.059Z”,“msg”:“AgentInfo()”,“grpc_service”:“gitlab.agent.reverse_tunnel.rpc.ReverseTunnel”,“grpc_method”:“Connect”,“error”:“HTTP status code: 301 for path /api/v4/internal/kubernetes/agent_info”}

2023-06-22_21:40:26.41481 {“level”:“error”,“time”:“2023-06-22T21:40:26.414Z”,“msg”:“AgentInfo()”,“grpc_service”:“gitlab.agent.reverse_tunnel.rpc.ReverseTunnel”,“grpc_method”:“Connect”,“error”:“HTTP status code: 301 for path /api/v4/internal/kubernetes/agent_info”}

2023-06-22_21:40:26.72947 {“level”:“error”,“time”:“2023-06-22T21:40:26.729Z”,“msg”:“AgentInfo()”,“grpc_service”:“gitlab.agent.agent_configuration.rpc.AgentConfiguration”,“grpc_method”:“GetConfiguration”,“error”:“HTTP status code: 301 for path /api/v4/internal/kubernetes/agent_info”}

I’ve tried connecting via websockets as well as directly to the grpc, the results are the same, I don’t understand why KAS is giving a 301 for path.

Any help? Thanks!

I was able to figure it out, turns out that because I’m accessing behind cloudflare tunnel through https but my gitlab is configure for http it generated the gitlab-kas-config.yml with the http address, I edited and changed to https and it worked!