简体   繁体   中英

Gitlab CI - registry and nginx

I am trying to setup self hosted gitlab CI with its own registry. I am also using self signed certificates for TLS, signed this certificate using my own CA, which is installed as a trusted CA in my host machine

Gitlab-CE 13.6.3 version is installed on Ubuntu 18.04. Have installed snap microk8s cluster on the same host

Questions (some very basics)

  • Does Gitlab registry use the docker daemon?

  • How is the connectivity achieved

    Docker client --> NGINX (5050) --> Gitlab registry (5000)

  • I have below configuration in gitlab.rb file

registry['enable'] = true
registry['registry_http_addr'] = "127.0.0.1:5000"
registry['log_directory'] = "/var/log/gitlab/registry"
registry['env'] = {
  'SSL_CERT_DIR' => "/etc/gitlab/ssl"
}

# Below you can find settings that are exclusive to "Registry NGINX"
registry_nginx['enable'] = true
registry_nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.local.crt"
registry_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.local.key"

registry_nginx['proxy_set_headers'] = {
 "Host" => "$http_host",
 "X-Real-IP" => "$remote_addr",
 "X-Forwarded-For" => "$proxy_add_x_forwarded_for",
 "X-Forwarded-Proto" => "https",
 "X-Forwarded-Ssl" => "on"
}

# When the registry is automatically enabled using the same domain as `external_url`,
# it listens on this port
registry_nginx['listen_port'] = 5050
registry_nginx['listen_addresses'] = ['*', '[::]']

When I try to docker login, following errors are observed. Is it expected based on the above configuration?

   - with URL: https://127.0.0.1:5000 - > Login Success
   - with URL: https://127.0.0.1:5050 - > Login Success 
   - with URL: https://gitlab.local:5050 - > x509 certificate signed by unknown authority
  • I have gitlab k8s & docker runners, Can they access the gitlab registry (nginx) port 5050 from within the container?
    [[runners]]
      name = "docker"
      token = "xxxxxxx"
      executor = "docker"
      [runners.docker]
        image = "docker:stable"
        privileged = true
        volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]

Note: I tried various gitlab forums/posts about the certificate issues on gitlab registry to build/push images, but to no success

Thank you

Try by placing the certificate in docker by:

sudo mkdir -p /etc/docker/certs.d/gitlab.local:5050
cp /yourcerts/gitlab.local.crt /etc/docker/certs.d/gitlab.local:5050/ca.crt
sudo service docker reload

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM