{"id":32890,"date":"2023-02-22T05:24:14","date_gmt":"2023-02-22T05:24:14","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=32890"},"modified":"2023-02-22T05:28:13","modified_gmt":"2023-02-22T05:28:13","slug":"how-to-configure-gitlab-chart-with-private-nexus-registry-for-images","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/how-to-configure-gitlab-chart-with-private-nexus-registry-for-images\/","title":{"rendered":"How to configure gitlab chart with private nexus registry for images"},"content":{"rendered":"\n<p>To configure GitLab chart with a private Nexus registry for images, you will need to do the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Create a Kubernetes secret for your Nexus registry credentials:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>kubectl create secret docker-registry nexus-registry \\\n  --docker-server=&lt;your-nexus-registry-url> \\\n  --docker-username=&lt;your-nexus-registry-username> \\\n  --docker-password=&lt;your-nexus-registry-password> \\\n  --docker-email=&lt;your-email-address>\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><strong>Update the <code>values.yaml<\/code> file for the GitLab chart to include the <code>imagePullSecrets<\/code> field, which references the secret you just created:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>global:\n  imagePullSecrets:\n    - name: nexus-registry\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><strong>Update the <code>values.yaml<\/code> file for the GitLab chart to include the <code>registry<\/code> field, which specifies the URL of your Nexus registry:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>gitlab:\n  registry:\n    enabled: true\n    host: &lt;your-nexus-registry-url>\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li><strong>If you are using a self-signed certificate for your Nexus registry, you will need to add the certificate to the GitLab Runner&#8217;s trusted certificates. You can do this by adding the certificate as a Kubernetes secret and updating the <code>values.yaml<\/code> file for the GitLab Runner chart to include the <code>extraVolumes<\/code> and <code>extraVolumeMounts<\/code> fields:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>gitlab-runner:\n  runners:\n    config: |\n      [[runners.kubernetes.volumes.hostPath]]\n      name = \"certs\"\n      hostPath = \"\/etc\/gitlab-runner\/certs\"\n      mountPath = \"\/etc\/gitlab-runner\/certs\"\n      readOnly = true\n    extraVolumes:\n      - name: certs\n        secret:\n          secretName: nexus-registry-certs\n    extraVolumeMounts:\n      - name: certs\n        mountPath: \"\/etc\/gitlab-runner\/certs\"\n        readOnly: true\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li><strong>Create a Kubernetes secret for your Nexus registry certificate:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>kubectl create secret generic nexus-registry-certs \\\n  --from-file=&lt;path-to-certificate-file>\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\" start=\"6\">\n<li>Install the GitLab chart and the GitLab Runner chart with the updated <code>values.yaml<\/code> files:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>helm install gitlab gitlab\/gitlab -f gitlab-values.yaml\nhelm install gitlab-runner gitlab\/gitlab-runner -f gitlab-runner-values.yaml\n<\/code><\/pre>\n\n\n\n<p>After following these steps, GitLab and GitLab Runner will be configured to use your private Nexus registry for images.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To configure GitLab chart with a private Nexus registry for images, you will need to do the following: kubectl create secret docker-registry nexus-registry \\ &#8211;docker-server=&lt;your-nexus-registry-url> \\ &#8211;docker-username=&lt;your-nexus-registry-username> \\ &#8211;docker-password=&lt;your-nexus-registry-password> \\ &#8211;docker-email=&lt;your-email-address> global: imagePullSecrets: &#8211; name: nexus-registry gitlab: registry: enabled: true host: &lt;your-nexus-registry-url> gitlab-runner: runners: config: | [[runners.kubernetes.volumes.hostPath]] name = &#8220;certs&#8221; hostPath = &#8220;\/etc\/gitlab-runner\/certs&#8221; mountPath =&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-32890","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32890","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=32890"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32890\/revisions"}],"predecessor-version":[{"id":32894,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/32890\/revisions\/32894"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=32890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=32890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=32890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}