본문으로 건너뛰기
본문으로 건너뛰기

Install the ClickHouse Operator with Operator Lifecycle Manager (OLM)

This guide covers installing the ClickHouse Operator using Operator Lifecycle Manager (OLM).

Prerequisites

  • Kubernetes cluster version 1.33.0 or later
  • kubectl configured to access your cluster
  • Cluster admin permissions
  • Installed OLM (Operator Lifecycle Manager)

Install OLM

If OLM isn't already installed in your cluster, install it:

# 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

Install the Operator

Install from GitHub Catalog

# 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

Uninstall

# 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

More info about uninstalling can be found in the OLM documentation.

Additional Resources