Deploy Helm Chart

This section introduces how you deploy Helm Chart.

The typical usage of deploying Helm Chart is to integrate middleware, many from in bitnami or open-source application tools such as Gitlab, and Jenkins in Helm Official Repo. KubeVela can help you easily deploy these applications to any managed cluster and manage them.

Starting from here, you will learn to use the KubeVela Addons to install plug-ins. The Helm Chart is currently supported by the FluxCD addon. In addition to the Helm Chart, FluxCD addon also supports Kustomize.

Before starting

  • Choose a Helm Chart you want to deploy. In the tutorial, we take bitnami/redis as an example.
  • Ensure that the cluster you deliver has a usable default StorageClass. Most of our delivery middleware requires data persistence, and the default StorageClass is needed to allocate PV.
  • Enable the VelaUX addon for UI console. If you are only CLI users, you can skip to Deploy via CLI

Enable fluxcd addon

Helm Chart delivery relies on addon in KubeVela, you need to enable fluxcd addon before start. You can refer to addon management doc for more detail information about addon.

  1. vela addon enable fluxcd

When the addon status become enabled, it means it’s ready for helm chart delivery.

Creating Redis application

After fluxcd addon enabled, there’s a helm definition added, you can check the parameter details by:

  1. vela show helm

You can also check the fluxcd addon docs for details.

Let’s take the redis chart as example, you can deploy by the following application:

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: helm-redis
  5. spec:
  6. components:
  7. - name: redis
  8. type: helm
  9. properties:
  10. repoType: "helm"
  11. url: "https://charts.bitnami.com/bitnami"
  12. chart: "redis"
  13. version: "16.8.5"
  14. values:
  15. master:
  16. persistence:
  17. size: 16Gi
  18. replica:
  19. persistence:
  20. size: 16Gi

Deploy it by:

  1. vela up -f https://kubevela.io/example/applications/app-with-chart-redis.yaml

Then check the deployment status of the application through vela status helm-redis

  1. About:
  2. Name: helm-redis
  3. Namespace: default
  4. Created at: 2022-04-21 17:19:12 +0800 CST
  5. Status: running
  6. Workflow:
  7. mode: DAG
  8. finished: true
  9. Suspend: false
  10. Terminated: false
  11. Steps
  12. - id:n1gxswwina
  13. name:redis
  14. type:apply-component
  15. phase:succeeded
  16. message:
  17. Services:
  18. - Name: redis
  19. Cluster: local Namespace: default
  20. Type: helm
  21. Healthy Fetch repository successfully, Create helm release successfully
  22. No trait applied

You can also check the application on UI, application created by CLI will be synced automatically but readonly.

Deploy Helm Chart from UI Console

The experience on UI console is quite the same with container image delivery. When it comes to deploying Helm Chart, all you need is to select type as helm.

The helm component type will automatically discovered after fluxcd addon enabled.

Then select the Target which has the default StorageClass that provides PV, and at last enter the deployment parameter configuration page.

helm app config

As shown, you need to do the following configuration:

  • Repo Type: Git and Helm are supported. In this example, we choose Helm.
  • Repo URL: Fill in the repo address you needed. we type in: https://charts.bitnami.com/bitnami. If you have configured the helm repo in Integration you can choose the repo directly.
  • Chart: After fill Helm repo URL, will list all available charts in this field. You can choose one from the list, here we choose: redis.
  • Version: After choosing the helm chart, will list all available versions in this field. Choose one version of this chart, here we choose: 16.8.5.
  • Values: After choosing the version, will list all parameters of this helm Chart. Since we are using ACK cluster in the example, PV has a minimum capacity requirement, 15Gi. In the same way, other parameters can also be configured according to your cluster’s status.

After filling in the above parameters, click Create to complete the application creation and enter the application configuration page. The following steps will stay the same as you’ve learned in Deploy First Application.

Modify deployment parameters

Clicking the component name, you can open the component configuration page. For the Helm Chart component, we can set the Values configuration options to change the application deployment parameters. the Values configuration options are generated by values.yaml, you can set the custom value for every option.

In the VelaUX, the value key format like replica.persistence.size=15Gi. they will be converted to YAML value:

  1. values:
  2. replica:
  3. persistence:
  4. size: 15Gi

After modifying the deployment parameters, the workflow of the environment must be executed to make the modified parameters take effect in the specified environment. Due to the existence of Revision, the configuration parameters will be saved in each historical version.

Visualize the resources created by Helm Release

For a helm chart, users often don’t know what resources they will create, making it difficult to troubleshoot. In VelaUX, users can visualize the resources created by Helm Release. via the resource graph, users could know the relationships between the resources and the status of all resources. Click the Detail action button could view the resource YAML.

resource-graph

You can hover your mouse on it to check the health status, by clicking the icon on the right, you can even get the yaml details for debug.

resource-detail

At this point, Helm Chart in KubeVela is no stranger to you, go ahead and try more!

Specify different value file

You can change the default values file values.yaml with another value file present inside the Helm chart by set the valuesFiles field. eg:

We use the chart hello-kubernetes-chart as an example.This chart has two values files. You can pull this chart and have a look all contains files in it:

  1. $ tree ./hello-kubernetes-chart
  2. ./hello-kubernetes-chart
  3. ├── Chart.yaml
  4. ├── templates
  5. ├── NOTES.txt
  6. ├── _helpers.tpl
  7. ├── config-map.yaml
  8. ├── deployment.yaml
  9. ├── hpa.yaml
  10. ├── ingress.yaml
  11. ├── service.yaml
  12. ├── serviceaccount.yaml
  13. └── tests
  14. └── test-connection.yaml
  15. ├── values-production.yaml
  16. └── values.yaml

As we can see, there are values files values.yaml values-production.yaml in this chart.If you not set the valuesFiles field, values.yaml will used by rendering the resources.

You can switch to use values-production.yaml by:

  1. cat <<EOF | vela up -f -
  2. apiVersion: core.oam.dev/v1beta1
  3. kind: Application
  4. metadata:
  5. name: hello-kubernetes
  6. spec:
  7. components:
  8. - name: hello-kubernetes
  9. type: helm
  10. properties:
  11. repoType: "helm"
  12. url: "https://wangyikewxgm.github.io/my-charts/"
  13. chart: "hello-kubernetes-chart"
  14. version: "0.1.0"
  15. valuesFiles:
  16. - "values-production.yaml"
  17. EOF

Files defined in field valuesFiles are merged in the order of this list with the last file overriding the first.

Example below values-production.yaml will override values.yaml if they have same value key.

  1. valuesFiles:
  2. - "values.yaml"
  3. - "values-production.yaml"

Now, you have learned the basic helm delivery. If you want to delivery Helm Chart into multi-clusters, you can refer to this blog.