This topic describes how to deploy OceanBase Migration Service (OMS) Community Edition in a single node by using Kubernetes (k8s).
Terms
OMS_IMAGE: After you use Docker to load the OMS Community Edition installation package, you can run the docker images command to obtain the [IMAGE ID] or [REPOSITORY:TAG] of the loaded image. This identifier is represented as <OMS_IMAGE>. For example:
$sudo docker images
REPOSITORY TAG IMAGE ID
work.oceanbase-dev.com/oceanbase/oms:feature_4.2.11_ce 2786e8a6eccd
In this case, <OMS_IMAGE> can be either work.oceanbase-dev.com/oceanbase/oms:feature_4.2.11_ce or 2786e8a6eccd. Please replace ${OMS_IMAGE} in the subsequent instructions with the appropriate value.
Deploy OMS Community Edition
Enter the k8s environment and prepare the configuration file.
Replace the parameters with their actual values based on your deployment environment. The
namevalue inkind: Namespacemust be consistent with thenamespacevalue in otherkindtypes.apiVersion: v1 kind: Namespace metadata: name: omsregion-1 --- apiVersion: v1 kind: ConfigMap metadata: name: oms-config namespace: omsregion-1 data: config.yaml: | "apsara_audit_enable": "false" "apsara_audit_sls_access_key": "" "apsara_audit_sls_access_secret": "" "apsara_audit_sls_endpoint": "" "apsara_audit_sls_ops_site_topic": "" "apsara_audit_sls_user_site_topic": "" "cm_is_default": !!bool "true" "cm_location": "0" # The node address is in the format of ${pod_name}.${service_name}.${namespace_name}.svc. # The pod_name is the name in kind: StatefulSet plus -ID. The ID starts from 0. For example, in a single-node deployment, if replicas is 1, the pod_name is oms-0. # The service_name is the name in the first kind: Service. # The namespace_name is the name in kind: Namespace. "cm_nodes": - "oms-0.oms-service.omsregion-1.svc" "cm_region": "hangzhou" "cm_region_cn": "Hangzhou" "cm_server_port": "8088" # The format is http://${service_name}.${namespace_name}.svc:8088. "cm_url": "http://oms-service.omsregion-1.svc:8088" "drc_cm_db": "cm_db_name" "drc_cm_heartbeat_db": "cm_hb_name" "drc_rm_db": "rm_db_name" "ghana_server_port": "8090" "init_db": "true" "nginx_server_port": "8089" "oms_meta_host": "xxx.xxx.xxx.1" "oms_meta_password": "oms_meta_password" "oms_meta_port": "2881" "oms_meta_user": "xxx@tenant_name" "sshd_server_port": "2023" "supervisor_server_port": "9000" "tsdb_enabled": "true" "tsdb_password": "tsdb_password" "tsdb_service": "INFLUXDB" "tsdb_url": "xxx.xxx.xxx.2:8086" "tsdb_username": "tsdb_username" --- apiVersion: v1 kind: Service metadata: name: oms-service namespace: omsregion-1 spec: clusterIP: None selector: app: oms --- apiVersion: v1 kind: Service metadata: name: oms-service-nodeport namespace: omsregion-1 spec: type: NodePort selector: app: oms ports: - name: nginx protocol: TCP port: 8089 targetPort: 8089 - name: ghana protocol: TCP port: 8090 targetPort: 8090 - name: cm protocol: TCP port: 8088 targetPort: 8088 - name: sshd protocol: TCP port: 2023 targetPort: 2023 --- apiVersion: apps/v1 kind: StatefulSet metadata: name: oms namespace: omsregion-1 labels: app: oms spec: replicas: 1 serviceName: "oms-service" selector: matchLabels: app: oms template: metadata: labels: app: oms spec: initContainers: - name: copy-config image: busybox:1.35 command: ['sh', '-c', 'cp /config-ro/config.yaml /work/config.yaml'] volumeMounts: - name: config-volume mountPath: /config-ro readOnly: true - name: writable-config mountPath: /work containers: - name: oms image: ${OMS_IMAGE} env: - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: OMS_HOST_IP # POD_NAME represents the name of the current Pod. Do not modify it. oms-service.omsregion-1 must be modified based on the actual ${service_name} and ${namespace_name}. value: $(POD_NAME).oms-service.omsregion-1.svc - name: HOST_DOCKER_VERSION value: "20.10.7" ports: - containerPort: 8088 - containerPort: 8089 - containerPort: 8090 - containerPort: 9000 - containerPort: 2023 volumeMounts: - name: writable-config mountPath: /home/admin/conf/config.yaml subPath: config.yaml - name: logs-volume mountPath: /home/admin/logs - name: store-volume mountPath: /home/ds/store - name: run-volume mountPath: /home/ds/run volumes: - name: config-volume configMap: name: oms-config - name: writable-config emptyDir: {} # Configure the disk capacity. Increase the capacity of the following three volumes as needed. # The minimum recommended capacity for logs-volume is 200 GiB. # The minimum recommended capacity for store-volume is 500 GiB. Store-volume stores incremental data. We recommend that you increase the value. # The minimum recommended capacity for run-volume is 300 GiB. volumeClaimTemplates: - metadata: name: logs-volume spec: accessModes: [ "ReadWriteOnce" ] storageClassName: "local-path" resources: requests: storage: 200Gi - metadata: name: store-volume spec: accessModes: [ "ReadWriteOnce" ] storageClassName: "local-path" resources: requests: storage: 500Gi - metadata: name: run-volume spec: accessModes: [ "ReadWriteOnce" ] storageClassName: "local-path" resources: requests: storage: 300GiInstall OMS Community Edition.
For example, if the configuration file is named
oms-k8s-statefulset.yaml, run the following command.kubectl apply -f oms-k8s-statefulset.yamlTo view the details of the nodes, run the following command.
kubectl get pods -n ${namespace_name} NAME READY STATUS RESTARTS AGE oms-0 1/1 Running 0 3m11s # View the installation log of OMS Community Edition. kubectl logs -f ${pod_name} -n ${namespace_name}View the external access port. The port mapped to 8089 is the browser access port for OMS Community Edition.
kubectl get svc -n ${namespace_name}
Uninstall OMS Community Edition
To uninstall OMS Community Edition, run the following command:
kubectl delete -f ${configuration file name}
Example:
kubectl delete -f oms-k8s-statefulset.yaml