<a id="co-values-file"></a>

# Deploy CFK with Custom Values

Customize Confluent for Kubernetes using Helm values when you install or update it.

Using Helm, you can:

* Set configuration values in a YAML file that you pass to `helm` commands
  using the `--values` or `-f` flag.
* Set configuration values as `key=value` pairs directly to `helm`
  commands using the `--set`, `--set-string`, and `--set-file` flags.
* Combine the above two approaches by setting base configuration options in a
  `values.yaml` file and overriding specific values on the command line
  using `--set` flags.

For more details on the Helm flags, see the [Helm documentation](https://helm.sh/docs/helm/helm_install/).

## Deploy CFK using a `values.yaml` file

### Step 1: Find the default `values.yaml` file

If you are using the Helm repository to deploy CFK, replace `<CFK-home>`
with a directory of your choice to store the pulled chart, then pull the
CFK chart:

```bash
mkdir -p <CFK-home>

helm pull confluentinc/confluent-for-kubernetes \
  --untar \
  --untardir=<CFK-home> \
  --namespace <namespace>
```

Expected: The `values.yaml` file is located in the
`<CFK-home>/confluent-for-kubernetes` directory.

If you are using a download bundle to deploy CFK, the `values.yaml` file is
located in the `helm/confluent-for-kubernetes` directory under where you
downloaded the bundle.

### Step 2: Copy the `values.yaml` file

Create a copy of the `values.yaml` file to customize CFK configuration. Do
not edit the default `values.yaml` file. Save your copy to any file
location, referred to in this guide as `<path-to-values-file>`.

Expected: A copy of `values.yaml` exists at `<path-to-values-file>`, and
you have not modified the default `values.yaml` file.

### Step 3: Preview the changes

This optional step lets you review the rendered Kubernetes manifests before
installing CFK. When you have a custom values file, run the `helm upgrade`
command with the `--dry-run=client` flag to preview. The `--dry-run=client`
flag does not apply the changes to the cluster, but prints the Kubernetes
manifests that would be applied:

```bash
helm upgrade --install confluent-operator \
  confluentinc/confluent-for-kubernetes \
  --values <path-to-values-file> \
  --namespace <namespace> \
  --dry-run=client
```

Expected: The rendered Kubernetes manifests print to the terminal, no
changes are applied to the cluster, and the output shows
`STATUS: pending-install`. If a `confluent-operator` release is already
installed, the output shows `STATUS: pending-upgrade` instead.

### Step 4: Install CFK with your custom values

Install CFK using the customized configuration:

```bash
helm upgrade --install confluent-operator \
  confluentinc/confluent-for-kubernetes \
  --values <path-to-values-file> \
  --namespace <namespace>
```

Expected: `Release "confluent-operator" does not exist. Installing it now.`,
followed by the message `STATUS: deployed`.

## Deploy CFK using the `--set` flag

To customize CFK without a values file, specify the configuration options
using the `--set` flag:

```bash
helm upgrade --install confluent-operator \
  confluentinc/confluent-for-kubernetes \
  --set <setting1>=<value1> \
  --set <setting2>=<value2> \
  ...
  --namespace <namespace>
```

Expected: `Release "confluent-operator" does not exist. Installing it now.`,
followed by the message `STATUS: deployed`.

## Related content

* To deploy CFK with the default configuration, see
  [Deploy Confluent for Kubernetes](co-deploy-operator.md#co-deploy-operator).
* To configure operator scope and namespaces, see [Configure Operator Scope and Namespaces](co-operator-scope.md#co-operator-scope).
* To tune CFK-level settings, see [Configure CFK-Level Settings](co-cfk-settings.md#co-cfk-settings).
