Understanding the Default Configuration
When deploying WordPress, the application configuration is defined via YAML files. For example, the Deployment template below sets several environment variables, such as WORDPRESS_BLOG_NAME, which derives its value from the values.yaml file. Below is an excerpt from the deployment file:The default values in the values.yaml file are intended to work “out-of-the-box.” Overriding them allows you to optimize the deployment for your specific needs.
Customizing Values Using Command Line Parameters
Helm deploys the WordPress application immediately using a single command, with no interactive prompt to modify the values.yaml file. To override defaults at installation time, use the--set flag. For example, the command below changes the blog name from “User’s Blog!” to “Helm Tut”:
--set flags to customize several parameters simultaneously.
Using a Custom Values File
When you need to override many default settings, using a custom values file is more efficient. Follow these steps to create and use a custom values file:-
Create a file named custom-values.yaml with the desired parameters:
-
Install the chart and override the default values with your custom file:
Modifying the Built-In values.yaml File
If you prefer making permanent changes to the chart’s default configuration, you can pull the chart locally, edit the built-in values.yaml file, and deploy from your modified version. Here are the steps:-
Pull the chart in its compressed form:
-
To pull and untar the chart in one step, run:
wordpress will be created. List its contents to verify the structure:
values.yaml file in your favorite text editor, apply your desired changes, and then install the chart from this local directory:
Always be sure to test your changes in a development environment before deploying to production.
Summary of Customization Methods
Below is a quick reference table summarizing the three methods for customizing Helm chart parameters in a WordPress deployment:
Each method provides different advantages depending on your deployment needs and workflow.
Conclusion
In this lesson, we covered three primary ways to customize a WordPress Helm chart:- Using the
--setflag to override default values inline. - Using a dedicated custom values file.
- Editing the built-in values.yaml file from a locally pulled chart.