{"id":325479,"date":"2021-08-16T15:03:52","date_gmt":"2021-08-16T12:03:52","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it\/"},"modified":"2021-08-16T15:03:52","modified_gmt":"2021-08-16T12:03:52","slug":"how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it\/","title":{"rendered":"#How to Use GitLab\u2019s New Helm Chart Repository \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2623cdcb7a4\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2623cdcb7a4\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it\/#Using_the_GitLab_Helm_Repository\" >Using the GitLab Helm Repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it\/#Adding_the_Repository_to_Helm\" >Adding the Repository to Helm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it\/#Pushing_to_the_Repository\" >Pushing to the Repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it\/#Using_Charts_in_the_Repository\" >Using Charts in the Repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it\/#Accessing_GitLabs_Repository_in_a_CI_Pipeline\" >Accessing GitLab\u2019s Repository in a CI Pipeline<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-use-gitlabs-new-helm-chart-repository-cloudsavvy-it\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Use GitLab\u2019s New Helm Chart Repository \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage aligncenter size-full wp-image-9546\" srcset=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/02\/266bb4cf.jpg?width=398&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 400w, https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/02\/266bb4cf.jpg?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 1200w\" sizes=\"auto, 400w, 1200w\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/02\/266bb4cf.jpg?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Graphic showing the GitLab logo, a stylised fox head\" width=\"1602\" height=\"902\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/about.gitlab.com\/releases\/2021\/07\/22\/gitlab-14-1-released\">GitLab 14.1 added<\/a> Helm charts to the software\u2019s growing list of supported package repository formats. You can now store and share your charts using your GitLab projects, without a separate Helm registry.<\/p>\n<p>Helm charts are a collection of Kubernetes YAML manifests distributed as a single package. They make it quicker and easier to deploy complex <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>lications into your cluster. Using GitLab as a registry lets your team store charts alongside your code in an organization-managed repository.<\/p>\n<h2 id=\"using-the-gitlab-helm-repository\"><span class=\"ez-toc-section\" id=\"Using_the_GitLab_Helm_Repository\"><\/span>Using the GitLab Helm Repository<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Make sure your GitLab instance has been updated to version 14.1. If you\u2019re using the hosted GitLab.com deployment, you\u2019ll already have everything you need.<\/p>\n<p>Prepare a simple Helm chart to push to your repository. Running <code>helm create example<\/code> will produce a new boilerplate chart called <code>example<\/code> if you\u2019ve not got one available. The generated chart will be ready to push straight up to GitLab, without any modification.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-13751\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/08\/a15b124c.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1280\" height=\"930\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Switch over to your GitLab instance. Either create a new project or find an existing one. Using the left sidebar, navigate to Packages &amp; Registries &gt; Package Registry within your project. If you don\u2019t see these menus, head to Settings &gt; <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/general\/\" data-internallinksmanager029f6b8e52c=\"3\" title=\"General\" target=\"_blank\" rel=\"noopener\">General<\/a>, expand the \u201cVisibility, project features, permissions\u201d heading, and enable the \u201cPackages\u201d toggle.<\/p>\n<h2 id=\"adding-the-repository-to-helm\"><span class=\"ez-toc-section\" id=\"Adding_the_Repository_to_Helm\"><\/span>Adding the Repository to Helm<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now you\u2019re ready to start using your package repository. You need to register it with your Helm client to begin with.<\/p>\n<pre>helm repo add &#13;\n    --username &lt;username&gt; &#13;\n    --password &lt;token&gt; &#13;\n    example-repo &#13;\n    https:\/\/gitlab.example.com\/api\/v4\/projects\/&lt;project&gt;\/packages\/helm\/stable<\/pre>\n<p>The local repository will be named <code>example-repo<\/code>. Replace <code>&lt;username&gt;<\/code> with your GitLab username. The value of <code>&lt;token&gt;<\/code> should be a personal access token that\u2019s got permission to push packages.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10399\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/03\/9c1a4001.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1268\" height=\"459\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You can generate a new token by clicking your profile icon in the top-right of GitLab\u2019s interface. Select \u201cPreferences\u201d from the menu, then \u201cAccess Tokens\u201d from the left sidebar. Add a new access token with the <code>api<\/code> scope. The <code>write_repository<\/code> scope might look correct but won\u2019t actually work; it only facilitates access using Git over HTTP, whereas Helm requires API integration.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-13754\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/08\/ac57eced.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1280\" height=\"720\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Substitute the <code>&lt;project&gt;<\/code> in your repository URL with the ID of the GitLab project you want to push to. You can find this on its homepage, underneath its name.<\/p>\n<h2 id=\"pushing-to-the-repository\"><span class=\"ez-toc-section\" id=\"Pushing_to_the_Repository\"><\/span>Pushing to the Repository<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Once the repository\u2019s been added, you can push any directory with a valid Helm chart up to your GitLab instance. It\u2019s usually easiest to install the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/chartmuseum\/helm-push\/#readme\"><code>helm-push<\/code><\/a> plugin which adds a native <code>helm push<\/code> command.<\/p>\n<p>Package your chart if you haven\u2019t already:<\/p>\n<pre>helm package example-chart<\/pre>\n<p>This will create a gzipped tar archive, <code>example-chart.tgz<\/code>, containing your chart.<\/p>\n<p>Add the <code>helm-push<\/code> plugin:<\/p>\n<pre>helm plugin install https:\/\/github.com\/chartmuseum\/helm-push.git<\/pre>\n<p>Finally, use the plugin to push your chart to your GitLab repository:<\/p>\n<pre>helm push example-chart.tgz example-repo<\/pre>\n<p>Back in the GitLab web interface, navigate to your project\u2019s Packages &amp; Registries &gt; Package Registry screen. You should see your chart show up.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-13752\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/08\/34fe1994.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1280\" height=\"720\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Click the chart\u2019s name to view its details. This screen lets you track the chart\u2019s history, download package files, and view older releases. You can delete the chart with the \u201cDelete\u201d button situated in the top-right.<\/p>\n<h2 id=\"using-charts-in-the-repository\"><span class=\"ez-toc-section\" id=\"Using_Charts_in_the_Repository\"><\/span>Using Charts in the Repository<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With the chart in your repository, you can deploy it into your Kubernetes cluster. <code>helm install<\/code> commands should work straightaway:<\/p>\n<pre># load the contents of repositories&#13;\nhelm repo update&#13;\n&#13;\n# install the chart&#13;\nhelm install example-repo\/example-chart<\/pre>\n<p>This will start a new chart deployment into your active cluster. Use the <code>--kubeconfig<\/code> and <code>--namespace<\/code> Helm flags if necessary to select an appropriate Kubernetes configuration file and specify the namespace to deploy into.<\/p>\n<h2 id=\"using-gitlabs-repository-in-a-ci-pipeline\"><span class=\"ez-toc-section\" id=\"Accessing_GitLabs_Repository_in_a_CI_Pipeline\"><\/span>Accessing GitLab\u2019s Repository in a CI Pipeline<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>As with its other package formats, GitLab\u2019s Helm repository benefits from built-in integration with the software\u2019s CI\/CD system. Your pipelines will receive preset environment variables which simplify the chart publication process. You don\u2019t need to set any custom CI variables to configure authentication.<\/p>\n<p>Here\u2019s an example pipeline which creates a chart and publishes it to your repository:<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"yaml\">\n<pre class=\"de1\"><span class=\"co4\">stages<\/span><span class=\"sy2\">:\n<\/span>  - helm-publish\n<span class=\"co4\">\nhelm-publish<\/span>:<span class=\"co3\">\n  stage<\/span><span class=\"sy2\">: <\/span>helm-publish<span class=\"co4\">\n  image<\/span>:<span class=\"co3\">\n    name<\/span><span class=\"sy2\">: <\/span>alpine\/helm:latest<span class=\"co3\">\n    entrypoint<\/span><span class=\"sy2\">: <\/span><span class=\"br0\">[<\/span><span class=\"st0\">\"\"<\/span><span class=\"br0\">]<\/span><span class=\"co4\">\n  script<\/span><span class=\"sy2\">:\n<\/span>    - helm repo add --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD my-repo $CI_REGISTRY\n    - helm package my-chart\n    - helm push my-chart.tgz my-repo<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>The <code>$CI_REGISTRY<\/code> variables are configured to let you push new packages into the registry. You can reuse them when authenticating to GitLab\u2019s other repositories, such as npm, Composer, NuGet, and Maven.<\/p>\n<h2 id=\"summary\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>GitLab now has an integrated Helm chart repository that lets you store your Kubernetes manifests alongside your code. Anyone with read access to the project\u2019s repository will be able to add it to their Helm client and deploy charts into Kubernetes clusters.<\/p>\n<p>When a new chart version is published, run <code>helm repo update<\/code> and then use <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/helm.sh\/docs\/helm\/helm_upgrade\"><code>helm upgrade<\/code><\/a> to move deployed installations to the new release. You can manage chart versions from within GitLab and delete old releases which are wasting disk space.\n<\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/13748\/how-to-use-gitlabs-new-helm-chart-repository\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Use GitLab\u2019s New Helm Chart Repository \u2013 CloudSavvy IT&#8221; GitLab 14.1 added Helm charts to the software\u2019s growing list of supported package repository formats. You can now store and share your charts using your GitLab projects, without a separate Helm registry. Helm charts are a collection of Kubernetes YAML manifests distributed as a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":325480,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/02\/266bb4cf.jpg","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-325479","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/325479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=325479"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/325479\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/325480"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=325479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=325479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=325479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}