How to customize Helm Chart values for the default addons in an RKE2 or K3s cluster
Article Number: 000020750
Environment
A Rancher-provisioned or standalone RKE2 cluster
Situation
Both RKE2 and K3s deploy several packaged components as add-ons via Helm charts, for example rke2-coredns, rke2-metrics-server, or traefik.
In both RKE2 and K3s, these Helm add-ons can be customized using a HelmChartConfig resource. Below is an example of a HelmChartConfig manifest, taken from the K3s documentation, to customize the traefik HelmChart in a K3s cluster.
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
image:
repository: docker.io/library/traefik
tag: 3.3.5
ports:
web:
forwardedHeaders:
trustedIPs:
- 10.0.0.0/8
RKE2 The Helm chart files for RKE2, including the default values.yaml, are located in the rke2-charts GitHub repository. To identify the correct chart version for your cluster, refer to the "Chart Versions" section of the RKE2 release notes. You can then inspect the values.yaml file in the repository to review all available configuration options.
K3s The Helm chart files for K3s are hosted in the k3s-charts GitHub repository. You can determine which chart version is deployed in your cluster by running kubectl get helmchart -A. Once identified, refer to the corresponding values.yaml file in the repository to check the available configuration options.
Resolution
A standalone RKE2 or K3s cluster
In an RKE2 or K3s cluster, a HelmChartConfig manifest should be written to a file in the manifests directory of server nodes. For RKE2, this is /var/lib/rancher/rke2/server/manifests; for K3s, it is /var/lib/rancher/k3s/server/manifests/.
For example, to customize the rke2-coredns Helm chart in an RKE2 cluster, create the file /var/lib/rancher/rke2/server/manifests/rke2-coredns-config.yaml and populate it with the desired HelmChartConfig manifest.
Similarly, to customize the traefik HelmChart in a K3s cluster, create the file /var/lib/rancher/k3s/server/manifests/traefik-config.yaml and populate it with the desired HelmChartConfig manifest.
In a standalone RKE2 cluster, this HelmChartConfig method can also be used to customize the CNI.
A Rancher-provisioned RKE2 or K3s cluster
Note: In Rancher-provisioned RKE2 clusters, a HelmChartConfig should not be used to customize the CNI configuration. Instead of defining a HelmChartConfig in the Additional Manifest section, you should edit the CNI configuration via the Add-on: [CNI Name] form under Cluster Configuration,
In a Rancher-provisioned RKE2 or K3s cluster, the HelmChartConfig manifest can be configured directly within the Rancher UI:
- Navigate to Cluster Management within the Rancher UI
- Click Edit Config for the desired RKE2 or K3s cluster.
- Under Cluster Configuration, click Additional Manifests.
- Enter the desired
HelmChartConfigmanifest into the text area. - Click Save to apply the changes.