> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Installer le ClickHouse Operator avec Operator Lifecycle Manager (OLM)

> Ce guide explique comment installer le ClickHouse Operator à l'aide de kubectl et de fichiers manifest.

Ce guide explique comment installer le ClickHouse Operator à l'aide d'Operator Lifecycle Manager (OLM).

<div id="prerequisites">
  ## Prérequis
</div>

* Version du cluster Kubernetes : 1.28.0 ou version ultérieure
* kubectl configuré pour accéder à votre cluster
* Permissions d’administration du cluster
* OLM (Operator Lifecycle Manager) installé

<div id="install-olm">
  ## Installer OLM
</div>

Si OLM n’est pas déjà installé dans votre cluster, installez-le :

```bash theme={null}
# Check if OLM is installed
kubectl get ns olm

# If not installed, install OLM
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.28.0/install.sh | bash -s v0.28.0
```

<div id="install-the-operator">
  ## Installer l’Operator
</div>

<div id="install-from-github-catalog">
  ### Installer depuis le catalogue de GitHub
</div>

```bash theme={null}
# Create the operator namespace
kubectl create namespace clickhouse-operator-system

# Create a CatalogSource
kubectl apply -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: clickhouse-operator-catalog
  namespace: clickhouse-operator-system
spec:
  sourceType: grpc
  image: ghcr.io/clickhouse/clickhouse-operator-catalog:latest
  displayName: ClickHouse Operator
  publisher: ClickHouse
  updateStrategy:
    registryPoll:
      interval: 30m
EOF

# Create the OperatorGroup
kubectl apply -f - <<EOF
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
  name: clickhouse-operator-group
  namespace: clickhouse-operator-system
EOF

# Create the Subscription
kubectl apply -f - <<EOF
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: clickhouse-operator
  namespace: clickhouse-operator-system
spec:
  channel: stable-v0
  name: clickhouse-operator
  source: clickhouse-operator-catalog
  sourceNamespace: clickhouse-operator-system
  installPlanApproval: Automatic
EOF
```

<div id="uninstall">
  ## Désinstallation
</div>

```bash theme={null}
# Delete the subscription
kubectl delete subscription clickhouse-operator -n clickhouse-operator-system
# Find all associated resources
kubectl get operator clickhouse-operator.clickhouse-operator-system -o=jsonpath="{.status.components.refs}" | jq 'map({kind, name})'
# Delete associated resources (CRDs, Deployments, etc.)
kubectl delete <resource> <name> [-n <namespace>]  # Repeat for each resource found

# Delete the OperatorGroup (optional):
kubectl delete operatorgroup clickhouse-operator-group -n clickhouse-operator-system
# Delete the Operator view
kubectl delete operator clickhouse-operator.clickhouse-operator-system
```

Vous trouverez plus d’informations sur la désinstallation dans la [documentation de l’OLM](https://olm.operatorframework.io/docs/tasks/uninstall-operator/).

<div id="additional-resources">
  ## Ressources complémentaires
</div>

* [Documentation de l’Operator Lifecycle Manager](https://olm.operatorframework.io/docs)
