Hi All,
i am new new on the gitlab commnunty.
I have configured gitlab server and working fine when i connect with aws cloud our gitlab-runner also working fine.
But when i configure gitlab-runner with gitlab server in my lab, i am getting beloow error. Can any one guide me, please.
Regards
Pradeep
{“level”:“error”,“time”:“2023-05-21T06:36:31.475Z”,“msg”:“Error handling a connection”,“mod_name”:“reverse_tunnel”,“error”:“Connect(): rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: failed to WebSocket dial: expected handshake response status code 101 but got 426"”}
Hi @techidee , welcome to the GitLab Community Forum! 
he specific problem seems to be occurring during the WebSocket connection attempt. The WebSocket protocol is a communication protocol that allows two-way communication between a client and a server.
The error message states, “expected handshake response status code 101 but got 426”. This suggests that the server was expected to return a status code of 101, which in HTTP terms means “Switching Protocols” and is used in response to an upgrade request header from the client (which is standard for initiating a WebSocket connection). However, instead of the expected 101 status, the server returned a 426 status code.
The HTTP status code 426 means “Upgrade Required”. It indicates that the client should switch to a different protocol such as TLS/1.0, as defined in the Upgrade header field.
Here are a few steps you can take to troubleshoot this issue:
-
Check your GitLab Runner configuration: Make sure that the URL for the GitLab server in your GitLab Runner configuration is correct and uses the right protocol (HTTP or HTTPS). You can find more information about configuring GitLab Runner in the official documentation.
-
Check your network settings: Ensure that there are no firewalls or other network configurations blocking the WebSocket connection between the GitLab Runner and the GitLab server.
1 Like
Hi Greg,
Thanks,
I am working as per shared link, i will update you on this very soon.
Regards
Pradeep
1 Like
Hi Greg,
I have folowe the give link but some how no sucess.
Please find the my infra details belows.
- Have k8s with 3 master nodes 2 worker nodes.
- loadbalacer help to communicate these 3 masters.
- On this cluster i have installed Gitlab Server in gitlab namespace.
- On this cluster, in another namespace i have installed gitlab-agent and gitlab-runner.
In the gitlab-runner and gitlab-agent have the same error.
Please correct me if anythihg wrong.
Thanks
Pradeep
Hello techidee,
The error message you provided indicates a connection problem between the GitLab Runner and the GitLab server in your lab environment. Specifically, it suggests that there was an error during the WebSocket handshake, where the expected response status code should be 101, but the received code was 426.
To troubleshoot this issue, you can follow these steps:
- Check network connectivity: Ensure that there are no network connectivity issues between the GitLab Runner and the GitLab server in your lab. Make sure both machines can communicate with each other over the required ports, such as SSH (port 22) and HTTP/HTTPS (port 80 or 443).
- Verify GitLab Runner configuration: Double-check the configuration of your GitLab Runner. Locate the configuration file (
config.toml
), which is typically found in /etc/gitlab-runner/
or /home/<user>/.gitlab-runner/
. Confirm that the URL specified in the configuration matches the GitLab server’s URL, and ensure the registration token is accurate.
- Check firewall settings: If you have a firewall in your lab environment, ensure that it allows incoming and outgoing connections on the necessary ports for GitLab Runner to communicate with the GitLab server. Consult your network administrator or adjust your firewall settings accordingly.
- Verify GitLab server status: Confirm that the GitLab server in your lab is running properly. Check the server logs for any errors or try accessing the GitLab web interface to ensure it is functioning correctly.
- Restart GitLab Runner: Try restarting the GitLab Runner service on the machine where it is installed. Depending on your operating system, you can use a command like
sudo systemctl restart gitlab-runner
on Linux. Restarting the runner can sometimes resolve temporary connection issues.
- Review logs: Examine the GitLab Runner logs located in
/var/log/gitlab-runner/
for any additional error messages or warnings. The logs may provide more details about the cause of the connection error.
If the issue persists after following these steps, I recommend seeking assistance from the GitLab community forums, official support channels, or consulting the GitLab Runner documentation. When seeking help, provide specific information such as the versions of GitLab and GitLab Runner you are using, along with relevant log entries. This will help others understand your setup and provide more targeted assistance.
Hello Sherry,
Thanks for the guidence.
Now i can able to connect my gitlab server with gitlab-agent. but on Gitlab server it is showing “Never connected” in my project at Infrastructure → Kubernetes clusters, and i am unable to see any error in gitlab-agent logs.
Please suggest.
Thanks
Pradeep
Hello All,
After add below entery in my “/etc/gitlab/gitlab.rb” on gitlab server. My gitlab-agent working fine.
gitlab_kas[‘enable’] = true
gitlab_kas[‘internal_api_listen_network’] = ‘unix’
gitlab_kas[‘internal_api_listen_address’] = ‘/var/opt/gitlab/gitlab-kas/sockets/internal-api.socket’
gitlab_kas[‘private_api_listen_network’] = ‘unix’
gitlab_kas[‘private_api_listen_address’] = ‘/var/opt/gitlab/gitlab-kas/sockets/private-api.socket’
gitlab_kas[‘env’] = {
‘SSL_CERT_DIR’ => “/opt/gitlab/embedded/ssl/certs/”,
‘OWN_PRIVATE_API_URL’ => ‘unix:///var/opt/gitlab/gitlab-kas/sockets/private-api.socket’
}
Regards
Pradeep