diff --git a/content/en/docs/application-store/external-apps/deploy-clickhouse.md b/content/en/docs/application-store/external-apps/deploy-clickhouse.md new file mode 100644 index 000000000..fe6f0c8b0 --- /dev/null +++ b/content/en/docs/application-store/external-apps/deploy-clickhouse.md @@ -0,0 +1,174 @@ +--- +title: "Deploy ClickHouse Operator and a ClickHouse Cluster on KubeSphere" +keywords: 'KubeSphere, Kubernetes, ClickHouse, ClickHouse Operator, ClickHouse Cluster' +description: 'Learn how to deploy ClickHouse Operator and a ClickHouse Cluster on KubeSphere.' +linkTitle: "Deploy ClickHouse Operator and a ClickHouse Cluster on KubeSphere" +weight: 14340 +--- + +[ClickHouse](https://clickhouse.tech/) is a column-oriented database management system (DBMS) for online analytical processing of queries (OLAP). ClickHouse on QingCloud is a deeply customized ClickHouse cluster application maintaining ClickHouse cluster functions and featuring automated cluster management, data redistribution in clusters, and excellent performance with less cost. + +This tutorial demonstrates how to deploy ClickHouse Operator and a ClickHouse Cluster on KubeSphere. + +## Prerequisites + +- You need to enable [the OpenPitrix system](../../../pluggable-components/app-store/). +- You need to create a workspace, a project, and two user accounts (`ws-admin` and `project-regular`) for this tutorial. The account `ws-admin` must be granted the role of `workspace-admin` in the workspace, and the account `project-regular` must be invited to the project with the role of `operator`. This tutorial uses `demo-workspace` and `demo-project` for demonstration. If they are not ready, refer to [Create Workspaces, Projects, Accounts and Roles](../../../quick-start/create-workspace-and-project/). + +## Hands-on Lab + +### Step 1: Deploy ClickHouse Operator + +1. Log in to the KubeSphere Web console as `admin`, and use **Kubectl** from the **Toolbox** in the bottom right corner to run the following command to install ClickHouse Operator. It is recommended that you have at least two worker nodes available in your cluster. + + ```bash + kubectl apply -f https://raw.githubusercontent.com/radondb/radondb-clickhouse-kubernetes/master/clickhouse-operator-install.yml + ``` + + {{< notice note >}} + + This command will install ClickHouse Operator in the namespace `kube-system`. Therefore, ClickHouse Operator only needs to be installed once in a Kubernetes cluster. + + {{}} + +2. You can see the expected output as below if the installation is successful. + + ``` + customresourcedefinition.apiextensions.k8s.io/clickhouseinstallations.clickhouse.qingcloud.com created + customresourcedefinition.apiextensions.k8s.io/clickhouseinstallationtemplates.clickhouse.qingcloud.com created + customresourcedefinition.apiextensions.k8s.io/clickhouseoperatorconfigurations.clickhouse.qingcloud.com created + serviceaccount/clickhouse-operator created + clusterrolebinding.rbac.authorization.k8s.io/clickhouse-operator-kube-system created + configmap/etc-clickhouse-operator-files created + configmap/etc-clickhouse-operator-confd-files created + configmap/etc-clickhouse-operator-configd-files created + configmap/etc-clickhouse-operator-templatesd-files created + configmap/etc-clickhouse-operator-usersd-files created + deployment.apps/clickhouse-operator created + service/clickhouse-operator-metrics created + ``` + +3. You can run the following command to view the status of ClickHouse Operator resources. + + ```bash + kubectl get all --selector=app=clickhouse-operator -n kube-system + ``` + + Expected output: + + ``` + NAME READY STATUS RESTARTS AGE + pod/clickhouse-operator-6b8494c8f-tmkmn 2/2 Running 0 6m34s + + NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE + service/clickhouse-operator-metrics ClusterIP 10.233.51.66 8888/TCP 6m34s + + NAME READY UP-TO-DATE AVAILABLE AGE + deployment.apps/clickhouse-operator 1/1 1 1 6m34s + + NAME DESIRED CURRENT READY AGE + replicaset.apps/clickhouse-operator-6b8494c8f 1 1 1 6m34s + ``` + +### Step 2: Add an app repository + +1. Log out of KubeSphere and log back in as `ws-admin`. In `demo-workspace`, go to **App Repositories** under **App Management**, and then click **Add**. + + ![add-repo](/images/docs/appstore/external-apps/deploy-clickhouse/add-repo.png) + +2. In the dialog that appears, enter `clickhouse` for the app repository name and `https://radondb.github.io/radondb-clickhouse-kubernetes/` for the repository URL. Click **Validate** to verify the URL and you will see a green check mark next to the URL if it is available. Click **OK** to continue. + + ![add-clickhouse](/images/docs/appstore/external-apps/deploy-clickhouse/add-clickhouse.png) + +3. Your repository displays in the list after successfully imported to KubeSphere. + + ![repo-added](/images/docs/appstore/external-apps/deploy-clickhouse/repo-added.png) + +### Step 3: Deploy a ClickHouse Cluster + +1. Log out of KubeSphere and log back in as `project-regular`. In `demo-project`, go to **Apps** under **Application Workloads** and click **Deploy New App**. + + ![click-deploy-new-app](/images/docs/appstore/external-apps/deploy-clickhouse/click-deploy-new-app.png) + +2. In the dialog that appears, select **From App Templates**. + + ![from-app-templates](/images/docs/appstore/external-apps/deploy-clickhouse/from-app-templates.png) + +3. On the new page that appears, select **clickhouse** from the drop-down list and then click **clickhouse-cluster**. + + ![clickhouse-cluster](/images/docs/appstore/external-apps/deploy-clickhouse/clickhouse-cluster.png) + +4. In the **Chart Files** tab, you can view the configuration and download the `values.yaml` file. Click **Deploy** to continue. + + ![chart-tab](/images/docs/appstore/external-apps/deploy-clickhouse/chart-tab.png) + +5. On the **Basic Information** page, confirm the app name, app version, and deployment location. Click **Next** to continue. + + ![basic-info](/images/docs/appstore/external-apps/deploy-clickhouse/basic-info.png) + +6. In the **App Configurations** tab, you can change the YAML file to customize configurations. In this tutorial, click **Deploy** to use the default configurations. + + ![click-deploy](/images/docs/appstore/external-apps/deploy-clickhouse/click-deploy.png) + +7. After a while, you can see the app status shown as **Running**. + + ![app-running](/images/docs/appstore/external-apps/deploy-clickhouse/app-running.png) + +### Step 4: View ClickHouse Cluster status + +1. In **Workloads** under **Application Workloads**, click the **StatefulSets** tab and you can see the StatefulSets are up and running. + + ![statefulsets-running](/images/docs/appstore/external-apps/deploy-clickhouse/statefulsets-running.png) + +3. Click a single StatefulSet to go to its detail page. You can see the metrics in line charts over a period of time under the **Monitoring** tab. + + ![statefulset-monitoring](/images/docs/appstore/external-apps/deploy-clickhouse/statefulset-monitoring.png) + +3. In **Pods** under **Application Workloads**, you can see all the Pods are up and running. + + ![pods-running](/images/docs/appstore/external-apps/deploy-clickhouse/pods-running.png) + +4. In **Volumes** under **Storage**, you can see the ClickHouse Cluster components are using persistent volumes. + + ![volumes](/images/docs/appstore/external-apps/deploy-clickhouse/volumes.png) + +5. Volume usage is also monitored. Click a volume item to go to its detail page. Here is an example of one of the data nodes. + + ![volume-status](/images/docs/appstore/external-apps/deploy-clickhouse/volume-status.png) + +6. On the **Overview** page of the project, you can see a list of resource usage in the current project. + + ![project-overview](/images/docs/appstore/external-apps/deploy-clickhouse/project-overview.png) + +### Step 5: Access the ClickHouse Cluster + +1. Log out of KubeSphere and log back in as `admin`. Hover your cursor over the hammer icon in the bottom right corner and then select **Kubectl**. + +2. In the window that appears, run the following command and then navigate to the username and password of the ClickHouse cluster. + + ```bash + kubectl edit chi clickho-749j8s -n demo-project + ``` + + ![get-username-password](/images/docs/appstore/external-apps/deploy-clickhouse/get-username-password.png) + + {{< notice note >}} + + In the above command, `clickho-749j8s` is the ClickHouse application name and `demo-project` is the project name. Make sure you use your own application name and project name. + + {{}} + +3. Run the following command to access the ClickHouse cluster, and then you can use command like `show databases` to interact with it. + + ```bash + kubectl exec -it chi-clickho-749j8s-all-nodes-0-0-0 -n demo-project -- clickhouse-client --user=clickhouse --password=c1ickh0use0perator + ``` + + ![use-clickhouse](/images/docs/appstore/external-apps/deploy-clickhouse/use-clickhouse.png) + + {{< notice note >}} + + In the above command, `chi-clickho-749j8s-all-nodes-0-0-0` is the Pod name and you can find it in **Pods** under **Application Workloads**. Make sure you use your own Pod name, project name, username and password. + + {{}} + diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/add-clickhouse.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/add-clickhouse.png new file mode 100644 index 000000000..85ff20ebf Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/add-clickhouse.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/add-repo.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/add-repo.png new file mode 100644 index 000000000..9758f614e Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/add-repo.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/app-running.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/app-running.png new file mode 100644 index 000000000..a59772823 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/app-running.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/basic-info.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/basic-info.png new file mode 100644 index 000000000..d03c17764 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/basic-info.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/change-nodeport.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/change-nodeport.png new file mode 100644 index 000000000..adb6d10ca Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/change-nodeport.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/chart-tab.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/chart-tab.png new file mode 100644 index 000000000..190a4258a Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/chart-tab.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/click-deploy-new-app.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/click-deploy-new-app.png new file mode 100644 index 000000000..5208b1b43 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/click-deploy-new-app.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/click-deploy.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/click-deploy.png new file mode 100644 index 000000000..df302f786 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/click-deploy.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/clickhouse-cluster.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/clickhouse-cluster.png new file mode 100644 index 000000000..5d870cf60 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/clickhouse-cluster.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/clickhouse-service.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/clickhouse-service.png new file mode 100644 index 000000000..246c18141 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/clickhouse-service.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/from-app-templates.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/from-app-templates.png new file mode 100644 index 000000000..06c85be5f Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/from-app-templates.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/get-username-password.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/get-username-password.png new file mode 100644 index 000000000..f45886e98 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/get-username-password.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/pods-running.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/pods-running.png new file mode 100644 index 000000000..a1e9a40fa Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/pods-running.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/project-overview.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/project-overview.png new file mode 100644 index 000000000..58e5a98fe Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/project-overview.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/repo-added.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/repo-added.png new file mode 100644 index 000000000..15833b536 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/repo-added.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/statefulset-monitoring.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/statefulset-monitoring.png new file mode 100644 index 000000000..1c1a068bc Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/statefulset-monitoring.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/statefulsets-running.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/statefulsets-running.png new file mode 100644 index 000000000..37986e08d Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/statefulsets-running.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/use-clickhouse.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/use-clickhouse.png new file mode 100644 index 000000000..17e047f39 Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/use-clickhouse.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/volume-status.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/volume-status.png new file mode 100644 index 000000000..3eb4e94fc Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/volume-status.png differ diff --git a/static/images/docs/appstore/external-apps/deploy-clickhouse/volumes.png b/static/images/docs/appstore/external-apps/deploy-clickhouse/volumes.png new file mode 100644 index 000000000..f9d96664f Binary files /dev/null and b/static/images/docs/appstore/external-apps/deploy-clickhouse/volumes.png differ