KubeBlocks
BlogsEnterprise
⌘K
​
Blogs

Overview
Quickstart
Architecture

Operations

Stop / Start / Restart
Vertical Scaling
Horizontal Scaling
Volume Expansion
Reconfigure
Switchover
Manage Services

Observability

Prometheus Integration
  1. Prerequisites
  2. Expose ClickHouse Externally
  3. Disable External Access
  4. Cleanup

Manage Services for ClickHouse

By default, ClickHouse services are only accessible within the cluster. Use an OpsRequest to expose the ClickHouse HTTP or native TCP port externally.

Prerequisites

    • A functional Kubernetes cluster (v1.21+ recommended)
    • kubectl v1.21+ installed and configured with cluster access
    • KubeBlocks installed (installation guide)
    • ClickHouse Add-on enabled
    • A demo namespace: kubectl create ns demo
    NOTE

    A LoadBalancer requires cloud provider support. On bare-metal or local clusters, use serviceType: NodePort instead and remove the annotations block.

    Expose ClickHouse Externally

    kubectl apply -f - <<EOF apiVersion: operations.kubeblocks.io/v1alpha1 kind: OpsRequest metadata: name: clickhouse-expose-enable namespace: demo spec: type: Expose clusterName: clickhouse-cluster expose: - componentName: clickhouse services: - name: internet serviceType: NodePort ports: - name: http port: 8123 targetPort: http switch: Enable EOF

    Monitor progress:

    kubectl get opsrequest clickhouse-expose-enable -n demo -w
    Example Output
    NAME TYPE CLUSTER STATUS PROGRESS AGE clickhouse-expose-enable Expose clickhouse-cluster Succeed 1/1 15s

    Get the external endpoint:

    kubectl get service -n demo -l app.kubernetes.io/instance=clickhouse-cluster
    Example Output
    NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE clickhouse-cluster-clickhouse-0 ClusterIP 10.100.xx.xx <none> 8123/TCP,... 10m clickhouse-cluster-clickhouse-0-headless ClusterIP None <none> ... 10m clickhouse-cluster-clickhouse-internet NodePort 10.100.yy.yy <none> 8123:3xxxx/TCP 15s

    Disable External Access

    kubectl apply -f - <<EOF apiVersion: operations.kubeblocks.io/v1alpha1 kind: OpsRequest metadata: name: clickhouse-expose-disable namespace: demo spec: type: Expose clusterName: clickhouse-cluster expose: - componentName: clickhouse services: - name: internet serviceType: NodePort switch: Disable EOF

    Cleanup

    kubectl delete opsrequest clickhouse-expose-enable clickhouse-expose-disable -n demo --ignore-not-found

    © 2026 KUBEBLOCKS INC