在k8s上部署DataEase

0. 环境

本次演示环境使用DataEase版本:v1.5.0
k8s环境包括1台master和1台worker;

1. 导入镜像

将DataEase安装包中的镜像一次导入到系统中,或导入到harbor中;
此次演示环境没有配置harbor,直接导入到两个k8s节点中:

#在master节点操作
cd /opt/dataease-v1.7.0-offline/images
docker load < dataease:v1.7.0.tar.gz
docker load < mysql:5.7.36.tar.gz

2. 创建共享目录

将共享存储挂载到Kubernetes各节点的/opt/nfs目录

共享存储可以使用nfs、minio等,此处省略存储系统配置方法

#在master节点操作
mkdir /opt/nfs/dataease/
#拷贝配置文件到共享目录
cp -r dataease-v1.7.0-offline/dataease/bin/ /opt/nfs/dataease/
cp -r dataease-v1.7.0-offline/dataease/templates/ /opt/nfs/dataease/conf
cp -r dataease-v1.7.0-offline/dataease/plugins /opt/nfs/dataease/

修改配置文件
vi /opt/nfs/dataease/conf/dataease.properties
直接将下面的配置替换原配置

# 数据库配置
spring.datasource.url=jdbc:mysql://mysql:3306/dataease?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.username=root
spring.datasource.password=Password123@mysql

carte.host=kettle
carte.port=18080
carte.user=cluster
carte.passwd=cluster

doris.db=dataease
doris.user=root
doris.password=Password123@doris
doris.host=doris-fe
doris.port=9030
doris.httpPort=8030

#新建用户初始密码
dataease.init_password=DataEase123456
#登录超时时间单位min  如果不设置 默认8小时也就是480
dataease.login_timeout=480

logger.level=INFO

3. 创建应用

3.1 创建MySQL

kubectl create -f 1.mysql-deploy.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
  namespace: de
spec:
  selector:
    matchLabels:
      app: mysql
  replicas: 1
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
        - name: mysql
          image: registry.cn-qingdao.aliyuncs.com/dataease/mysql:5.7.36
          imagePullPolicy: IfNotPresent
          env:
            - name: MYSQL_ROOT_PASSWORD
              value: "Password123@mysql"
          ports:
            - containerPort: 3306
              protocol: TCP
          volumeMounts:
            - name: mysql-conf
              mountPath: /etc/mysql/conf.d/my.cnf
            - name: mysql-data
              mountPath: /var/lib/mysql
            - name: mysql-sql
              mountPath: /docker-entrypoint-initdb.d
      volumes:
        - name: mysql-conf
          hostPath:
            path: /opt/nfs/dataease/conf/my.cnf
        - name: mysql-data
          hostPath:
            path: /opt/nfs/dataease/data/mysql
        - name: mysql-sql
          hostPath:
            path: /opt/nfs/dataease/mysql
---
apiVersion: v1
kind: Service
metadata:
  name: mysql
  namespace: de
spec:
  ports:
    - name: mysql
      protocol: TCP
      port: 3306
      targetPort: 3306
      nodePort: 30306
  type: NodePort
  selector:
    app: mysql

3.2 创建dataease

kubectl create -f 5.dataease-deploy.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: dataease
  namespace: de
spec:
  selector:
    matchLabels:
      app: dataease
  replicas: 1
  template:
    metadata:
      labels:
        app: dataease
    spec:
      containers:
        - name: dataease
          image: registry.cn-qingdao.aliyuncs.com/dataease/dataease:v1.5.0
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 8081
              protocol: TCP
          volumeMounts:
            - name: dataease-conf
              mountPath: /opt/dataease/conf
            - name: dataease-logs
              mountPath: /opt/dataease/logs
            - name: dataease-plug
              mountPath: /opt/dataease/plugins/thirdpart
            - name: dataease-kettle
              mountPath: /opt/dataease/data/kettle
      volumes:
        - name: dataease-conf
          hostPath:
            path: /opt/nfs/dataease/conf
        - name: dataease-logs
          hostPath:
            path: /opt/nfs/dataease/logs
        - name: dataease-plug
          hostPath:
            path: /opt/nfs/dataease/plugins
        - name: dataease-kettle
          hostPath:
            path: /opt/nfs/dataease/data/kettle
---
apiVersion: v1
kind: Service
metadata:
  name: dataease
  namespace: de
spec:
  ports:
    - name: dataease
      protocol: TCP
      port: 8081
      targetPort: 8081
      nodePort: 30801
  type: NodePort
  selector:
    app: dataease

4. 检查部署状态

[root@demo-cluster-master-1 ~]# kubectl get pod,svc -n de

NAME                            READY   STATUS    RESTARTS   AGE
pod/dataease-5c566598b6-mjhdr   1/1     Running   0          15h
pod/mysql-78b68c6645-8lczs      1/1     Running   0          15h

NAME               TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                               AGE
service/dataease   NodePort    172.20.45.21     <none>        8081:30801/TCP                        15h
service/mysql      NodePort    172.20.154.98    <none>        3306:30306/TCP                        15h

5. 访问DataEase页面

http://nodeIP:30801
在k8s上部署DataEase_第1张图片

6. 使用说明

当前在Kubernetes上部署DataEase的环境,仅支持直连模式,在使用创建数据集操作时,数据库数据集直连模式是正常的;定时抽取和上传Excel文件功能无法使用,因为该功能依赖Doris,而Doris目前不支持在Kubernetes部署;
待Doris官方支持在Kubernetes部署后将继续更新。

你可能感兴趣的:(k8s,dataease,dataease,数据展示)