Create Cloud-Native Repositories Using Helm Charts (GitHub,AWS S3)
Helm is the application package manager running on top of Kubernetes. It allows describing the application structure through convenient helm-charts and managing it with simple commands.
Why is Helm important for Kubernetes deployments?
- Kubernetes Helm fills the need to quickly and reliably provision container applications through easy install, update, and removal. It provides a vehicle for developers to package their applications and share them with the Kubernetes community.
- It allows software vendors to offer their containerized applications at “the push of a button”. Through a single command or a few mouse clicks, users can install Kubernetes apps for Dev-test or production environments.
- Adoption of Helm might be the key to mass adoption of microservices, as using this package manager simplifies their management greatly. Check here to know more about the importance of microservices.
- It provides the ability to configure the application during deployment. You can not only specify the Kubernetes resources (deployments, services, etc.) that make up your application, but also environment-specific configuration for those resources. This allows the same Helm chart to be used across your environments.
- It can actually play a major role in optimizing an organization’s CI/CD integration with Kubernetes.
Before moving into the private helm repository creation, we believe that you are familiar with the helm and creating helm chart, if not kindly check out the linked document.
Uses of having own helm repository:
Managing separate chart per application is easier for the simple monolithic application but it may find difficult to dealing with microservices. You are going to end up with lots of charts all over the place. Lots of repetition and difficult to manage at scale. Creating new applications also requires more effort, you’ve got to wire up a chart correctly. So moving into the chart repository solves this burden. Chart repository is a group of charts are placed together, which is easier to manage especially for microservice based applications.
There are many ways to create own helm repository, here two main methods are briefly explained:
1. Create a helm chart repo in GitHub:
You can use either public or private GitHub repository.
To create a repo and for adding packages, follow these commands:
$ helm package $YOUR_CHART_PATH/ # to build the .tgz file and copy it here
$ helm repo index . # create or update the index.yaml for repo
$ git add .
$ git commit -m ‘New chart version’
$ git push
To Access your repository:
If your repo is Public then follow these set of commands:
$ helm repo add sample ‘https://raw.githubusercontent.com/user-name/repository-name/master/'
$ helm repo update
$ helm search jenkins
If your repo is private, then create “Personal access tokens” and invoke the below commands:
$ helm repo add sample ‘https://MY_PRIVATE_TOKEN@raw.githubusercontent.com/user-name/repository-name/master/'
$ helm repo update
$ helm search jenkins
2. Create a helm chart repo in AWS S3:
To create the s3 bucket in AWS refer to this document for detailed descriptions.
Install the Plugin
To provide S3 protocol support the following commands need to be invoked:
$ helm plugin install https://github.com/hypnoglow/helm-s3.git
Downloading and installing helm-s3 v0.5.2 …
Installed plugin: s3
Now create a folder which should include index.yaml file along with the helm chart. Push the folder to s3 bucket by running the following command:
$ helm S3 init s3://bucket-name/folder-name
Adding charts to s3:
$ helm repo add sample s3://bucket-name/folder-name
“sample” has been added to your repositories
Check whether the repository is added or not:
$ helm repo list
To search for the application in repo, run:
$ helm search sample
NAME CHART VERSION APP VERSION DESCRIPTION
sample/jenkins 1.7.2 lts Open source continuous integration server. It supports mu…
Install jenkins from the added repository:
$ helm install sample/jenkins — name=jenkins
To remove the repository from the list, run:
$ helm repo remove repo-name
This post details about how to create helm chart repository in GitHub(both private and public) and S3 using the Helm S3 plugin. Also described about how to push the chart to repository, search and installing the charts.
For more details cloud-native information, please refer to Yobitel Communications.