Override Harness Kubernetes Service Settings
Harness Kubernetes Service Config Variables, Config Files, and values.yaml settings can be overwritten by Harness Environments Service Configuration Overrides.
This enables you to have a Service keep its settings but change them when the Service is deployed to the Environment.
For example, you might have a single Service but an Environment for QA and an Environment for Production, and you want to overwrite the
namespace setting in the Service values.yaml depending on the Environment.
In this topic:
- Before You Begin
- Step 1: Select the Service to Override
- Option 1: Variable Override
- Option 2: File Override
- Option 3: Values YAML
- Option 4: Helm Chart
- Next Steps
Before You Begin
- Define Kubernetes Manifests
- Using Harness Config Variables in Manifests
- Using Harness Config Files in Manifests
Step 1: Select the Service to Override
- In the Harness Environment, in the Service Configuration Overrides section, click Add Configuration Overrides. The Service Configuration Override settings appear.
- In Service, select the Service you are using for your Kubernetes deployment.
- Select one of the Override Type options.
Option 1: Variable Override
- Click Variable Override. The Variable Override options appear.
- In Configuration Variable, select a variable configured in the Service's Config Variables settings.
- In Type, select Text or Encrypted Text.
- In Override Value, enter the value to overwrite the variable value in the Service. If you selected Encrypted Text in Type, you can select an Encrypted Text values defined in Secrets Management.
Option 2: File Override
- Click File Override.
- In File Name, select a file configured in the Service's Config Files settings.
- In File, select the file to overwrite the Service's Config Files file.
Option 3: Values YAML
- Click Values YAML. Click Local or Remote.
- Local - Enter in the values.yaml variables and values just as your would in a Service Manifests values.yaml. Ensure the name of the variable you want to overwrite is identical.
- Remote - Specify the Git repo branch and folder for the remote manifest files to use, as explained in Add Source Repo Providers.
Option 4: Helm Chart
- Click Helm Chart.
- In Location of Helm Chart, you must pick the same location that you used in your Harness Kubernetes Service when you set up your link to the remote Helm chart: Either Helm Repository or Source Repository.
For example, here you can see the Helm Chart from Helm Repository option was selected in the Harness Service Remote Manifests settings, and so the corresponding Helm Repository location is selected in the Service Configuration Overrides:
- In Chart Name, enter the name of the chart to use when overriding the chart select in the Service(s).
- In Chart Version, enter the chart version to use. This is found in the chart.yaml
versionlabel. If you leave this field empty Harness gets the latest chart.
- Override for all Services is not supported for Helm chart override. If you select All Services in Service, the Helm Chart option is not available in Override Type.
- If you select a location type in Location of Helm Chart that is different from the location type you selected in the Service Remote Manifests, deployment will fail.
- You can use some overrides together. For example, you can use both Helm Chart Overrides with Values YAML Overrides for the same Harness Service. Harness will merge the overrides:
Here is an example of overwriting a Service values.yaml with a Service Configuration Override.
In the Service values.yaml, we have a variable for
This is used in the manifest file like this:
Now, in Service Configuration Override, you can overwrite the Service values.yaml
replicas value using the Local option:
At deployment runtime to this Environment, the overwritten
replicas values is used: