William DA SILVA
Web Developer

Today I learned about CNAME and Helm charts

Written on: Dec 21, 2020 • Last update: Dec 21, 2020

CNAME on root domain

One thing I learned today is that you cannot have a CNAME record on your root domain. At least, by the spec you can't but some DNS providers allows it like Namecheap and some other don't like DigitalOcean.

You can learn more about that subject here https://www.freecodecamp.org/news/why-cant-a-domain-s-root-be-a-cname-8cbab38e5f5c/

Helm chart repository with Github Pages

Today I learned that you can host your own Helm server using Github Pages!

I've recently discovered a bug in the devspace default helm chart and needed to fix that to allow wildcard domains (See PR https://github.com/devspace-cloud/component-chart/pull/31).

To fix it, I needed to fork the repo and use the fixed one for my deployment.

By seaching a bit, I've found that you can have your helm chart repository by simply publishing the repo containing the Helm charts.

To publish the charts, you need to run in your Github repository :

helm package .

This will create a tgz file corresponding to the charts you have in that repo. Once made, you can create an index file referencing all those tgz files, with their name, description and version.

helm repo index .

A new file is created called index.yaml that contains something like:

apiVersion: v1
entries:
  component-chart:
  - apiVersion: v1
    created: "2020-12-21T14:50:34.269195+01:00"
    description: A general purpose helm chart for deploying components of an application
    digest: 61a9e808354cca8fdf13ac3e13eda613ee653e3d37bcd0e99457d2d80c7dda12
    name: component-chart
    urls:
    - component-chart-0.0.0.tgz
    version: 0.0.0
generated: "2020-12-21T14:50:34.268544+01:00"

Once that made, you can publish this repo using Github Pages. On your Github repository settings view, go to the "Github Pages" section and "Publish"' the repository.

When publishing, it will exposes a Github page under williamdasilva.github.io/component-chart containing a brief documentation about the charts and as you can see in the index.yaml, you have your chart https://williamdasilva.github.io/component-chart/index.yaml

To use your newly created and published chart, you just have to reference it in your manifest. Here I use devspace to deploy my things to my Kubernetes cluster.

deployments:
- name: api
  helm:
    chart:
      name: component-chart
      repo: https://williamdasilva.github.io/component-chart