Helm Chart

Helm Chart?

Helm is a tool to help you manage Kubernetes applications. It uses a packaging format called Helm Chart, which allows you to define / install / upgrade / delete Kubernetes applications. For example, when a deployment must be defined and there is a required role, Helm bundles it and manages it like a package. In addition to creating your own software, you can easily download and use software created by others using Helm. Typical examples are metrics-server and Prometheus.

In this chapter, we will look at how you can deploy Helm Chart to EKS cluster with CDK.

Deploy Helm Chart

Open lib/container-stack.ts. Paste the following code inside constructor.

    cluster.addHelmChart(`flux`, {
      repository: 'https://charts.fluxcd.io',
      chart: 'flux',
      release: 'flux',
      values: {

When installing Helm Chart, CDK’s custom resource uses helm upgrade --install command. This means that if you have the same release name, it will try to update. Helm Chart is distributed as a CloudFormation resource. Therefore, when it is deleted from the CDK code or deleted from the stack, it is deleted from the cluster through the helm uninstall command.

A few things to keep in mind when specifying your Helm Chart.

  • repository must be a full URL. In general, not in CDK, before you issue the command helm install stable/xx, you register the repository called stable in advance. Similar to this, you should give the context of repository by giving the full path.
  • If you don’t specify a release name, it is randomized to use the last 53 characters of the node ID. If you do not want this, give the value of ‘release’ as human understandable.
  • In addition, you can check details required for chart distribution.

Identifying resources to be created

Let’s check the resources to be created with the command below.

cdk diff

You can see that the chart will be created as shown below.

Stack ClusterStack-ap-northeast-2
[+] Custom::AWSCDK-EKS-HelmChart demogo-cluster/chart-flux/Resource demogoclusterchartfluxB1DF1B54

Stack ContainerStack-ap-northeast-2
There were no differences


Let’s deploy the container with the command below.

cdk deploy ClusterStack-ap-northeast-2
  • If you have created a stack in another region, make sure the correct region name comes after ClusterStack.
  • Why run ClusterStack, not ContainerStack? If you are curious, please check out this.

The progress is printed on the terminal. Use the following command to confirm that the new pod has been deployed by our definition of Helm Chart as shown below.

kubectl get pod
NAME                                READY   STATUS    RESTARTS   AGE
flux-675747bc8c-pxnq2               1/1     Running   0          36s << NEW POD FROM HELM CHART
flux-memcached-869757cb88-ccpj8     1/1     Running   0          36s << NEW POD FROM HELM CHART
nginx-deployment-5bf87f5f59-l9xwt   1/1     Running   0          35s
nginx-deployment-5bf87f5f59-lpmqg   1/1     Running   0          35s