Helm stands out as the package manager of the cloud native landscape. Love or hate it, chances are you’ve used a helm chart at some point in your Kubernetes journey. In this tutorial, we will look at how to host helm charts using Civo’s object store.
Prerequisites
This tutorial assumes some familiarity with Helm. In addition, you will need the following tools installed locally:
Helm Chart Repositories
The helm documentation describes a chart repository as:
A chart repository is an HTTP server that houses an index.yaml
file and optionally some packaged charts. When you're ready to share your charts, the preferred way to do so is by uploading them to a chart repository.
If you’re familiar with containers, you can think of a chart repository along the same lines as a container registry or, more popularly, DockerHub.
Helm supports a couple of methods for hosting your charts. As mentioned earlier, we will be focusing on using Civo’s object storage as a chart repository.
Creating an Object Store
We’ll begin by creating an object store that will house our charts. In your terminal, run the following command to create an object store:
Generate object store credentials:
civo objectstore credentials create helm-repo
Create the object store:
civo objectstore create experimental-repo --owner-access-key helm-repo --wait
Output:
Created Object Store experimental-repo in LON1 in 0 min 1 sec
Created default admin credentials, access key is MXOH2JWQJN, this will be deleted if the Object Store is deleted. To access the secret key run: civo objectstore credential secret --access-key=MXOH2JWQJN
More information about Civo's Object store.
Installing the Helm S3 Plugin
To handle the chart uploads, we will be using the helm S3 plugin, to install, run the following command:
helm plugin install https://github.com/hypnoglow/helm-s3.git
Creating a chart
Before we make any uploads, let’s create a helm chart, in a directory of your choosing run the following command:
helm create objectstore-demo
This will create a basic chart, which installs nginx, this will be sufficient as the main focus here is the repository to which the chart gets uploaded.
Next, package the chart into an archive format:
helm package objectstore-demo --version 1.0.0
This will create a compressed archive of our chart. We provide a version of the chart using the --version
flag.
Uploading the Chart
Begin by exporting the credentials for your S3 bucket. In your terminal, run the following commands:
export AWS_ACCESS_KEY_ID=<your access key>
export AWS_SECRET_ACCESS_KEY=<your secret key>
export AWS_ENDPOINT=https://objectstore.lon1.civo.com
export AWS_DISABLE_SSL=true
In the snippet, we export the access key, secret key, and endpoint of the target objectstore. You should be able to retrieve it from the credentials section of your Civo dashboard.
The AWS_ENDPOINT
variable describes the region in which the object store is located; because the object store is in the LON1
region, the endpoint is https://objectstore.lon1.civo.com
in general the format will be https://objectstore.<region>.civo.com
Next, initialize the helm repository in your object store:
helm s3 init s3://experimental-repo
;
Add the repository:
Continue by adding the helm repository locally using the following command:
helm repo add experimental-repo s3://experimental-repo
Push the chart:
Finally, push the chart using:
helm s3 push ./objectstore-demo-1.0.0.tgz experimental-repo
Output:
Successfully uploaded the chart to the repository.
We can verify the chart was uploaded by heading over to the object store tab in your Civo dashboard ↓
Clean up (Optional)
If you aren’t sure about retaining the resources you just provisioned, here’s how to clean them up
Delete the object store:
civo objectstore rm experimental-repo
Delete the object store credentials:
civo objectstore credentials rm helm-repo
Summary
In this tutorial, we discussed how to host helm charts using Civo’s object storage, a lot of the heavy lifting was done by the S3 plugin by Igor Zibarev. Looking to explore other cool things to do with Civo’s object storage? Here are some ideas:
- Learn how to automate database backups using CronJobs
- Learn how to use Civo’s object store as Terraform backend