<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jan Larwig</title>
    <description>The latest articles on DEV Community by Jan Larwig (@tuunit).</description>
    <link>https://dev.to/tuunit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1149133%2F3d23795f-67c0-432f-95e7-3ed2de2d4cd0.jpg</url>
      <title>DEV Community: Jan Larwig</title>
      <link>https://dev.to/tuunit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tuunit"/>
    <language>en</language>
    <item>
      <title>Simplify Kubernetes Development and Testing with Helm-Compose</title>
      <dc:creator>Jan Larwig</dc:creator>
      <pubDate>Wed, 04 Oct 2023 21:52:06 +0000</pubDate>
      <link>https://dev.to/tuunit/simplify-kubernetes-development-and-testing-with-helm-compose-35mi</link>
      <guid>https://dev.to/tuunit/simplify-kubernetes-development-and-testing-with-helm-compose-35mi</guid>
      <description>&lt;p&gt;Helm is a powerful tool for managing applications on Kubernetes using charts. Helm enables you to define, install, and upgrade even complex applications with ease. However, when it comes to testing and development of multiple systems with separate Helm charts, it can sometimes be a bit cumbersome to manage all the resources, values, and dependencies.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;Helm-Compose&lt;/strong&gt; comes into play, offering a solution to simplify and streamline the process and allow for full Configuration-as-Code support for all Helm CLI options.&lt;/p&gt;




&lt;h1&gt;
  
  
  What exactly is Helm-Compose?
&lt;/h1&gt;

&lt;p&gt;It allows you to define and manage multiple Helm releases in a single docker-compose-like YAML file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://seacrew.github.io/helm-compose/"&gt;https://seacrew.github.io/helm-compose/&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.1&lt;/span&gt;

&lt;span class="na"&gt;releases&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;blog&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;chart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bitnami/wordpress&lt;/span&gt;
    &lt;span class="na"&gt;chartVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;14.3.2&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;blogs&lt;/span&gt;
    &lt;span class="na"&gt;createNamespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;

&lt;span class="na"&gt;repositories&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;bitnami&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://charts.bitnami.com/bitnami&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;Unfortunately, Helm charts don't support &lt;a href="https://github.com/helm/helm/issues/2247"&gt;multiple layers of dependencies&lt;/a&gt; and a lot of Helm charts already have one or more dependencies on other charts like Redis or PostgreSQL. Therefore, a wrapper Helm chart around wouldn't suffice to setup all your deployments in one package. Furthermore, not all things could be encapsulated inside a Helm chart. Especially not options meant for the Helm CLI itself like network and security flags.&lt;/p&gt;

&lt;p&gt;For this reason the idea of &lt;strong&gt;Helm-Compose&lt;/strong&gt; was born.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;With &lt;strong&gt;Helm-Compose&lt;/strong&gt;, you can specify all your necessary Helm releases, their charts, Helm options and values in a single file. Making it easy to start, stop, and manage your Kubernetes applications during development from one central file with two simple commands:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;helm compose up&lt;/code&gt; and &lt;code&gt;helm compose down&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This allows you to have a code revision of &lt;strong&gt;all&lt;/strong&gt; helm options/flags you need for you deployments.&lt;/p&gt;




&lt;h1&gt;
  
  
  Getting started
&lt;/h1&gt;

&lt;p&gt;Helm v3.10+ already needs to be installed on your system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;Install the latest version of &lt;strong&gt;Helm-Compose&lt;/strong&gt; with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm plugin &lt;span class="nb"&gt;install &lt;/span&gt;https://github.com/seacrew/helm-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create Helm-Compose file
&lt;/h2&gt;

&lt;p&gt;Create a &lt;code&gt;helm-compose.yaml&lt;/code&gt; file in your project directory and define your Helm releases, charts, and values.&lt;/p&gt;

&lt;p&gt;Here's a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.1&lt;/span&gt;

&lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;wordpress&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;local&lt;/span&gt;

&lt;span class="na"&gt;releases&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;site1&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;chart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bitnami/wordpress&lt;/span&gt;
    &lt;span class="na"&gt;chartVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;14.3.2&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;site1&lt;/span&gt;
    &lt;span class="na"&gt;createNamespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="c1"&gt;# You can either use values directly&lt;/span&gt;
    &lt;span class="c1"&gt;# or value files or even both together&lt;/span&gt;
    &lt;span class="c1"&gt;# valueFiles:&lt;/span&gt;
    &lt;span class="c1"&gt;#   - ./values/wordpress.yaml&lt;/span&gt;
    &lt;span class="na"&gt;values&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;wordpressBlogName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Awesome Site&lt;/span&gt;
      &lt;span class="na"&gt;wordpressPassword&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;awesome&lt;/span&gt;
      &lt;span class="na"&gt;mariadb.auth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;rootPassword&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;awesome-password"&lt;/span&gt;

&lt;span class="na"&gt;repositories&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;bitnami&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://charts.bitnami.com/bitnami&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Deployment / Spin-Up
&lt;/h2&gt;

&lt;p&gt;Now you are ready to deploy your simple stack with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm compose up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you don't use one of the following expected file names you can use the optional &lt;code&gt;-f&lt;/code&gt; flag to define the path to your &lt;strong&gt;Helm-Compose&lt;/strong&gt; file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;helm-compose.yaml&lt;/li&gt;
&lt;li&gt;helm-compose.yml&lt;/li&gt;
&lt;li&gt;helmcompose.yaml&lt;/li&gt;
&lt;li&gt;helm-compose.yml&lt;/li&gt;
&lt;li&gt;helmcompose.yaml&lt;/li&gt;
&lt;li&gt;helmcompose.yml&lt;/li&gt;
&lt;li&gt;helmcompose&lt;/li&gt;
&lt;li&gt;compose.yaml&lt;/li&gt;
&lt;li&gt;compose.yml
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm compose up &lt;span class="nt"&gt;-f&lt;/span&gt; mycomposefile.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Tear-Down
&lt;/h2&gt;

&lt;p&gt;For the tear-down use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;helm compose down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Further Features
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Managing of repositories:&lt;/strong&gt; As the keen-eyed among you might already have detected in the previous YAML example, you can manage your Helm chart repositories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;repositories&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;bitnami&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://charts.bitnami.com/bitnami&lt;/span&gt;
  &lt;span class="na"&gt;hashicorp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://helm.releases.hashicorp.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://seacrew.github.io/helm-compose/latest/key-features-and-use-cases/#repository-handling"&gt;https://seacrew.github.io/helm-compose/latest/key-features-and-use-cases/#repository-handling&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Revision Management:&lt;/strong&gt; To be able to detect changes, especially removals between &lt;code&gt;helm compose (up/down)&lt;/code&gt; executions. &lt;strong&gt;Helm-Compose&lt;/strong&gt; creates encoded revisions similar to how Helm does it for single releases. However you have quite a bit control over where those revisions will be stored:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="c1"&gt;# revision file name&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-revision&lt;/span&gt;
  &lt;span class="c1"&gt;# revision storage provider type&lt;/span&gt;
  &lt;span class="c1"&gt;# currently supports local files,&lt;/span&gt;
  &lt;span class="c1"&gt;# kubernetes secrets and s3&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;k8s&lt;/span&gt; &lt;span class="c1"&gt;# default: local&lt;/span&gt;
  &lt;span class="c1"&gt;# number of revisions to be stored&lt;/span&gt;
  &lt;span class="na"&gt;numberOfRevisions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt; &lt;span class="c1"&gt;# default 10&lt;/span&gt;
  &lt;span class="c1"&gt;# custom options for the selected&lt;/span&gt;
  &lt;span class="c1"&gt;# storage provider. in this case&lt;/span&gt;
  &lt;span class="c1"&gt;# a k8s namespace for storage&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;config-as-code&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Furthermore, revision handling allows for rollback to previous versions.&lt;/p&gt;

&lt;p&gt;General revision handling docs:&lt;br&gt;
&lt;a href="https://seacrew.github.io/helm-compose/latest/key-features-and-use-cases/#revision-handling"&gt;https://seacrew.github.io/helm-compose/latest/key-features-and-use-cases/#revision-handling&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Storage provider details:&lt;br&gt;
&lt;a href="https://seacrew.github.io/helm-compose/latest/storage-providers/"&gt;https://seacrew.github.io/helm-compose/latest/storage-providers/&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Benefits and Conclusion
&lt;/h1&gt;

&lt;p&gt;So why and when would &lt;strong&gt;Helm-Compose&lt;/strong&gt; be helpful to you?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Simplified Local Development:&lt;/strong&gt; &lt;strong&gt;Helm-Compose&lt;/strong&gt; provides a declarative way to define and manage your Helm releases. This means you can easily define the entire application stack in a single YAML file, including dependencies, and launch it with a single command as one unit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improved Collaboration:&lt;/strong&gt; Sharing a &lt;strong&gt;Helm-Compose&lt;/strong&gt; YAML file makes it simple for team members to get up and running with exactly the same application configuration and have a code revision of each and every Helm flag.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Isolation of Resources:&lt;/strong&gt; Each Helm release defined in the &lt;strong&gt;Helm-Compose&lt;/strong&gt; file is still isolated from the others, which mimics the behavior of running these releases separately in a production cluster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reproducible Environments:&lt;/strong&gt; With &lt;strong&gt;Helm-Compose&lt;/strong&gt;, you can ensure that your development environment closely matches your production environment. This helps uncover issues early in the development process and minimizes surprises when deploying to multiple environment and devices.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>kubernetes</category>
      <category>helm</category>
      <category>devops</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
