After learning the knowledge of chart structure and template, I will practice MySQL Chart again and I believe I will gain more.

Preparation before chart installation

As a preparation, the use of Chart should be clear before installation. This information is typically recorded in values. Yaml and readme.md. Instead of downloading the source file to view, executing Helm Inspect Values is probably a more convenient method.

The output is actually the contents of values.yaml. Read the comments to see what parameters MySQL Chart supports and what you need to do before installing it. One section is about storage:

Chart defines a PersistentVolumeClaim and requests 8G PersistentVolume. Since our experimental environment does not support dynamic provisioning, we need to create the corresponding PV in advance, and its configuration file mysql-pv.yml contains the following contents:

Mysql > create PV mysql-pv

Now you can install Chart.

Customize the installation chart

In addition to accepting the default values of values.yaml, we can also customize chart, such as setting mysqlRootPassword.

Helm has two ways to pass configuration parameters:

  1. Specify your values file. Yaml: helm inspect values mysql > myvalues. Yaml: helm inspect values mysql > myvalues. Then run helm install –values=myvalues.yaml mysql.

  2. Pass the parameter value directly through –set, as in:

MysqlRootPassword is set to abc123. In addition, -n sets release to my, and the name of each resource is my-mysql.

You can view the latest status of chart by helm List and Helm Status.

The PVC is already Bound and Deployment is AVAILABLE.

Upgrade and roll back Release

After release is released, you can upgrade it by running Helm Upgrade, applying the new configuration with –values or –set. For example, update MySQL 5.7.15:

Wait for some time. The upgrade succeeds.

Helm History can view all versions of Release. You can rollback to any version with helm rollback.

Rollback succeeded, MySQL restored to 5.7.14.

So at this point, I think you’re already familiar with chart. In the next section, we’ll learn how to develop our own chart.

Books:

1. Kubernetes in 5 Minutes every day item.jd.com/26225745440…

2. Docker Container Technology in 5 minutes a day item.jd.com/16936307278…

3. Play OpenStack in 5 Minutes every day item.jd.com/12086376.ht…