I am trying to set up the GitLab Kubernetes Agent Server as per the official GitLab documentation. The GitLab agent is running on a Docker VM with the provided Docker Compose.
I have made a specific configuration as per the docs that if it’s running behind a proxy, it should listen on a Unix socket for the internal connection. However, I am getting an error in the logs stating “Program aborted: listen unix /var/opt/gitlab/gitlab-kas/sockets/private-api.socket: bind: address already in use”.
Here’s the Docker Compose and GitLab Agent configuration:
Docker Compose:
version: '3.6'
services:
web:
image: 'gitlab/gitlab-ee:16.4.1-ee.0'
....
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://git.example.com'
....
GitLab Agent Configuration:
gitlab_kas['log_level'] = 'debug'
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'
}
The error log:
2023-10-27_08:19:45.94814 Program aborted: listen unix /var/opt/gitlab/gitlab-kas/sockets/private-api.socket: bind: address already in use
2023-10-27_08:19:55.97839 Program aborted: listen unix /var/opt/gitlab/gitlab-kas/sockets/internal-api.socket: bind: address already in use
I also encountered an issue where, when I didn’t change any of the configuration for the agent, there were no errors in the logs, but on the web interface, the error was that GitLab was unable to list clusters, despite adding an agent configuration that worked perfectly fine on gitlab.com.
GitLab is also unable to list the agent that was created based on a config file:
I then stumbled upon another blog post:
The there provided configuration didn’t change anything. The log still didn’t state anything out of the ordinary, and the error messaged in the GitLab GUI were the same.
The current configuration looks as follows:
##! Settings used by the GitLab application
gitlab_rails['gitlab_kas_enabled'] = true
gitlab_rails['gitlab_kas_external_url'] = 'wss://gitlab.company.com/-/kubernetes-agent/'
gitlab_rails['gitlab_kas_internal_url'] = 'grpc://localhost:8153'
##! Define to enable GitLab KAS
gitlab_kas_external_url "wss://gitlab.company.com/-/kubernetes-agent/"
gitlab_kas['enable'] = true
Could anyone provide any insights into how to resolve these errors and successfully configure the GitLab Kubernetes Agent Server? Any help would be greatly appreciated.