NOTES.txt File, Post-Install Upgrade Instructions for Helm Chart Users

Helm - NOTES.txt File, Post-Install Upgrade Instructions for Helm Chart Users

In this blog, we will look at what is NOTES.txt file in a Helm chart.

Some Helm charts can get pretty complex, installing and interconnecting a lot of objects in your Kubernetes cluster. As such, it can be pretty confusing for users how they should continue after installing a chart. How do I connect to this Kubernetes package/app? How do I manage it? What are the username and password? What do I need to do during an upgrade? All such questions can be answered immediately after a chart install or upgrade, by displaying helpful information to the user. This can be done by adding a special file named NOTES.txt to the chart’s templates/ directory.

The NOTES.txt file is rendered just like a regular template file by Helm, the only difference is that after it’s rendered, it’s not sent out to Kubernetes, but rather, the content is displayed in the command line window/terminal, for the user to see. Since it’s treated as a regular template, it means we can use the same techniques and tricks we used up until now. We can fetch values from the values.yaml file, we can fetch values from the chart’s name, release’s name, add if conditional blocks, use flow control, functions, pipelines, and so on. But, as usual, theory can sound a bit mysterious so let’s see this in practice.

Let’s create the NOTES.txt file using your favorite text editor and we can add instructions about how users can connect to the Nginx web server after installing this chart. Paste this content into your NOTES.txt file.

Please wait a few seconds until the {{ .Chart.Name }} chart is fully installed.

After installation is complete, you can access your website by running this command:

kubectl get --namespace {{ .Release.Namespace }} service {{ .Release.Name }}-nginx

and then entering the IP address you get, into your web browser's address bar.

Now when we install this chart using the command helm install test ./nginx we’ll see this output:

[email protected]:~$ helm install test ./nginx
NAME: test
LAST DEPLOYED: Sat Jun 12 00:17:11 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Please wait a few seconds until the nginx chart is fully installed.

After installation is complete, you can access your website by running this command:

kubectl get --namespace default service test-nginx

and then entering the IP address you get, into your web browser's address bar.

Great! Now our chart users have all the info they need.

Read more in the official documentation here

Checkout the Helm for the Absolute Beginners course here

Checkout the Complete Kubernetes learning path here