> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/kubernetes/cd-kubernetes-category/add-and-override-values-yaml-files.md).

# Add and override values YAML files

Add values YAML files to Kubernetes and Helm services in Harness, and override them at the environment level or at pipeline runtime.

You can use values YAML files for Kubernetes and Helm deployments in Harness.

For Kubernetes manifests, the values file uses Go templating to template manifest files. Go to [Example Kubernetes Manifests using Go Templating](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/kubernetes/cd-k8s-ref/example-kubernetes-manifests-using-go-templating.md) for an example.

For Helm charts, the values file defines the default values for parsing the Kubernetes templates (manifests) when deploying the Helm chart. Go to [Deploy Helm Charts](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/helm/deploy-helm-charts.md) for more information.

Harness supports Kubernetes and Helm charts without requiring Helm or Tiller, and Kubernetes and Helm have equal support for all Harness deployment strategies.

You can overlay and override multiple values files in a stage's Service in a few ways. For example, by overlaying multiple files and by replacing file paths dynamically at runtime.

This topic describes how to add values files, how to override them at the Service and Environment, and how to override them at Pipeline runtime.

## What you will learn from this topic

* How to add values YAML files for [Kubernetes and Helm charts](#values-yaml-files-with-kubernetes-and-helm-charts).
* How to [add a values.yaml file](#add-valuesyaml) to a Service.
* How to [override values at the Environment](#override-values-in-an-environment) and [at Pipeline runtime](#override-values-at-runtime).

## Before you begin <a href="#before-you-begin" id="before-you-begin"></a>

Review the following quickstarts before you add values YAML files.

* [Kubernetes CD Quickstart](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/kubernetes/kubernetes-cd-quickstart.md)
* [Helm CD Quickstart](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/helm/helm-cd-quickstart.md)

## Limitations <a href="#limitations" id="limitations"></a>

The following limitations apply:

* For Kubernetes deployments, the values.yaml file used in Harness does not support Helm templating, only Go templating.
* Helm templating is fully supported in the remote Helm charts you add to your Harness Service. If you add a Helm chart and a values.yaml, the values.yaml can use Helm templating.

## Propagate and override between stages <a href="#propagate-and-override-between-stages" id="propagate-and-override-between-stages"></a>

This topic covers adding and overriding the values.yaml files you add to a Harness Service, but you can also propagate and override entire Services.

Go to [Propagate and Override CD Services](/continuous-delivery/use-continuous-delivery/cd-building-blocks/services/propagate-and-override-cd-services.md) for more information.

## Values YAML files with Kubernetes and Helm charts <a href="#values-yaml-files-with-kubernetes-and-helm-charts" id="values-yaml-files-with-kubernetes-and-helm-charts"></a>

The following sections describe how values files are used with Kubernetes and Helm charts in Harness.

<details>

<summary>Kubernetes</summary>

You can use values YAML files with your Kubernetes manifests in Harness. This allows you to define several Kubernetes resources as a set.

```bash
files/
|-values.yaml
|-templates/
 |-deployment.yaml
 |-namespace.yaml
 |-service.yaml
```

Harness evaluates the values.yaml files you add just like Helm does with its values file. Values.yaml files added to Harness do not use Helm templating, but instead use [Go templating](https://godoc.org/text/template) and [Harness built-in variable expressions](https://developer.harness.io/harness-platform/use-harness-platform/variables-and-expressions/harness-variables). This removes the need for Helm or Tiller to be installed.

</details>

<details>

<summary>Helm charts</summary>

The typical Helm chart uses the following files:

```bash
chart/              # Helm chart folder
|-Chart.yaml        # chart definition
|-requirements.yaml # optional charts to deploy with your chart
|-values.yaml       # values for the template variables
|-templates/        # directory containing the template files (Kubernetes manifests)
```

Harness supports Helm charts using Helm templating. Harness evaluates the Helm chart just like Helm. You do not need to install Helm on the Harness Delegate pod/host. Harness manages Helm for you.

</details>

### Values YAML files for Kubernetes and Helm charts <a href="#visual-summary" id="visual-summary"></a>

The following video shows how to add values YAML files for Kubernetes and Helm charts.

{% embed url="<https://www.youtube.com/watch?v=dVk6-8tfwJc>" %}

## Artifacts with manifests and charts <a href="#artifacts-with-manifests-and-charts" id="artifacts-with-manifests-and-charts"></a>

You can hardcode the deployment artifact in your values.yaml file just as you might in a typical Helm deployment.

Or you can add a path to the artifact in Harness and use a [Harness expression](https://developer.harness.io/harness-platform/use-harness-platform/variables-and-expressions/harness-variables) in your values.yaml to refer to that path.

When Harness executes the Pipeline, the Harness Delegate resolves the expression and pulls the artifact onto the target pods.

Adding artifacts to Harness is covered in [Add Container Images as Artifacts for Kubernetes Deployments](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/kubernetes/cd-kubernetes-category/add-artifacts-for-kubernetes-deployments.md).

Once you have added the artifact to Harness, you add the Harness expression `<+artifact.image>` in your values.yaml using the `image` label: `image: <+artifact.image>`.

For example:

```yaml
name: myapp
replicas: 2

image: <+artifact.image>
dockercfg: <+artifact.imagePullSecret>
```

Artifacts and manifests are discussed in detail in [Add Kubernetes Manifests](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/kubernetes/cd-kubernetes-category/define-kubernetes-manifests.md).

## Add values.yaml <a href="#add-valuesyaml" id="add-valuesyaml"></a>

You can add one or more values YAML files in two ways:

* **Same repo:** If the values YAML files are in the same repo as your Kubernetes manifests or Helm charts, you can add them when you add those files. You use the Values YAML setting.

  ![The Values YAML setting in the manifest wizard](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-bcb526eef42af90f9f9f05b4a50cc34a1a9d42bf%2Fadd-and-override-values-yaml-files-32.png?alt=media)
* **Different repos:** If the values YAML files are in a repo separate from your Kubernetes manifests or Helm charts, or you want to add them separately, you can add them by selecting the Values YAML manifest type. The following steps describe this option.

1. In your CD stage, click **Service**.
2. In **Service Definition**, select **Kubernetes**.
3. In **Manifests**, click **Add Manifest**.
4. In **Specify Manifest Type**, select **K8s Manifest**, and click **Continue.**

   ![The Specify Manifest Type panel with K8s Manifest selected](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-c285a13e5e7deb8ad28dd92a54a8030e4f8675c8%2Fadd-and-override-values-yaml-files-33.png?alt=media)
5. In **Specify K8s Manifest Store**, select the Git repo provider you are using and then create or select a Connector to that repo.
6. If you have not set up a Harness Delegate, you can add one as part of the Connector setup. This process is described in [Kubernetes deployment tutorial](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/kubernetes/kubernetes-cd-quickstart.md), [Helm Chart deployment tutorial](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/helm/helm-cd-quickstart.md) and [Install a Kubernetes Delegate](https://developer.harness.io/harness-platform/use-harness-platform/delegates/delegate/install-delegates/overview).
7. Once you have selected a Connector, click **Continue**.
8. In **Manifest Details**, you tell Harness where the values.yaml is located.
9. In **Manifest Identifier**, enter a name that identifies the file, such as **values**.
10. In **Git Fetch Type**, select a branch or commit Id for the manifest, and then enter the Id or branch.
11. For **Specific Commit ID**, you can also use a [Git commit tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging).
12. In **File Path**, enter the path to the values.yaml file in the repo.

    You can enter multiple values file paths by clicking **Add File**. At runtime, Harness will compile the files into one values file.

    If you use multiple files, the highest priority is given from the last file, and the lowest priority to the first file. For example, if you have 3 files and the second and third files contain the same `key:value` as the first file, the third file's `key:value` overrides the second and first files.

    ![The File Path settings for the values YAML file](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-c4d2b323f944519175c1193724b84bf9501ae4ea%2Fadd-and-override-values-yaml-files-34.png?alt=media)
13. Click **Submit**. The values file(s) are added to the Service.

![The values file added to the Service](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-587939cc38b290adc3d8e5de8b8f59db4529000d%2Fadd-and-override-values-yaml-files-35.png?alt=media)

## Override values in an environment <a href="#override-values-in-an-environment" id="override-values-in-an-environment"></a>

You can override the values YAML file for a stage's Environment by mapping the Environment name to the values file or folder. Next, you use the `<+env.name>` Harness expression in the values YAML path.

The following example shows a repo with three values files, dev.yaml, qa.yaml, and prod.yaml. In the **File Path** for the values file, you use the `<+env.name>` expression.

Next, in the **Environment** setting, you add three Environments, one for each YAML file name.

![Environment names mapped to values YAML files](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-e6e7700c67f1599af9e453eba33a70b747adabeb%2Fadd-and-override-values-yaml-files-36.png?alt=media)

When you select an Environment, such as **qa**, the name of the Environment is used in **File Path** and resolves to **qa.yaml**. At runtime, the **qa.yaml** values file is used.

Instead of selecting the Environment in the **Infrastructure** each time, you can set the Environment as a **Runtime Input** and then enter **dev**, **qa**, or **prod** at runtime.

## Override values at runtime <a href="#override-values-at-runtime" id="override-values-at-runtime"></a>

You can make the values file path a **Runtime Input** and enter the name of the values file when you run the Pipeline.

In **Manifest Details** for the values file, in **File Path**, select **Runtime Input**. At runtime, you enter the name of the values file to use.

![The File Path setting set to Runtime Input](https://3694223630-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy1JhZ4oKIppwY7d5AhPj%2Fuploads%2Fgit-blob-72a6ae48e9d534979b1e3db43af598fa5e7561d2%2Fadd-and-override-values-yaml-files-37.png?alt=media)

## Next steps <a href="#see-also" id="see-also"></a>

Continue with the following topics.

* [Deploy Helm Charts](/continuous-delivery/use-continuous-delivery/deploy-services-on-different-platforms/helm/deploy-helm-charts.md)
* [Propagate and Override CD Services](/continuous-delivery/use-continuous-delivery/cd-building-blocks/services/propagate-and-override-cd-services.md)

{% @harness-feedback/feedback %}
