> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the ClickHouse Operator with kubectl

> This guide covers installing the ClickHouse Operator using kubectl and manifest files.

This guide covers installing the ClickHouse Operator using kubectl and manifest files.

<h2 id="prerequisites">
  Prerequisites
</h2>

* Kubernetes cluster v1.28.0 or later
* kubectl v1.28.0 or later
* Cluster admin permissions

<h2 id="install-from-release-manifests">
  Install from Release Manifests
</h2>

<Note>
  Requires cert-manager to issue webhook certificates.
</Note>

Install the operator and CRDs from the latest release:

```bash theme={null}
kubectl apply --server-side --force-conflicts -f https://github.com/ClickHouse/clickhouse-operator/releases/latest/download/clickhouse-operator.yaml
```

Server-side apply is required because the combined CRDs exceed the client-side apply size limit. For environments that only support client-side apply, use the description-stripped CRD variant:

```bash theme={null}
kubectl apply -f https://github.com/ClickHouse/clickhouse-operator/releases/latest/download/clickhouse-operator-stripped-crds.yaml
```

This will:

1. Create the `clickhouse-operator-system` namespace
2. Install CustomResourceDefinitions (CRDs) for ClickHouseCluster and KeeperCluster
3. Create necessary ServiceAccounts, Roles, and RoleBindings
4. Deploy the operator controller manager
5. Register webhooks for resource validation and defaulting
6. Configure SSL certificates using cert-manager
7. Enable metrics endpoint

<h2 id="verify-installation">
  Verify Installation
</h2>

Check that the operator is running:

```bash theme={null}
kubectl get pods -n clickhouse-operator-system
```

Expected output:

```
NAME                                                 READY   STATUS    RESTARTS   AGE
clickhouse-operator-controller-manager-xxxxxxxxxx    1/1     Running   0          1m
```

Verify the CRDs are installed:

```bash theme={null}
kubectl get crd | grep clickhouse.com
```

Expected output:

```
clickhouseclusters.clickhouse.com    2025-01-06T00:00:00Z
keeperclusters.clickhouse.com        2025-01-06T00:00:00Z
```

<h2 id="configure-custom-deployment-options">
  Configure Custom Deployment Options
</h2>

If you want to configure operator deployment options, follow the steps below.

<Steps>
  <Step>
    <h3 id="clone-the-repository">
      Clone the Repository
    </h3>

    ```bash theme={null}
    git clone https://github.com/ClickHouse/clickhouse-operator.git
    cd clickhouse-operator
    ```
  </Step>

  <Step>
    <h3 id="configure-installation-options">
      Configure installation options
    </h3>

    Edit config/default/kustomization.yaml to enable/disable features as needed.

    * To disable webhooks, comment out the `[WEBHOOK]` and `[CERTMANAGER]` sections.
    * To enable secure metrics endpoint, comment out `[METRICS]` sections and uncomment `[METRICS SECURE]` and `[CERTMANAGER]` sections.
    * To enable ServiceMonitor for Prometheus Operator, uncomment the `[PROMETHEUS]` section.
    * To enable operator network policies, uncomment the `[NETWORK POLICY]` section.
  </Step>

  <Step>
    <h3 id="build-and-deploy">
      Build and Deploy
    </h3>

    Build the operator manifests and apply them:

    ```bash theme={null}
    make build-installer VERSION=<required operator version> [IMG=<custom registry path>]
    kubectl apply --server-side --force-conflicts -f dist/install.yaml
    ```
  </Step>
</Steps>
