大数跨境

K8s集群+Rancher Server:部署DolphinScheduler 3.2.2集群

K8s集群+Rancher Server:部署DolphinScheduler 3.2.2集群 海豚调度
2025-09-02
0
导读:本文手把手演示了如何在K8s + Rancher环境中快速拉起一套生产可用的DolphinScheduler 3.2.2集群。

点击蓝字,关注我们

本文手把手演示了如何在 K8s + Rancher 环境中快速拉起一套生产可用的 Apache DolphinScheduler 3.2.2 集群。全文围绕“镜像加速、依赖本地化、存储持久化”三大痛点展开,附有详细的代码解析,收藏细看吧!


1

环境准备

1、软件准备

2、环境规划


2

部署

1、官网下载apache-dolphinscheduler源码

[root@master ~]# mkdir /opt/dolphinscheduler#[root@master ~]# cd /opt/dolphinscheduler[root@master dolphinscheduler]# curl -Lo https://dlcdn.apache.org/dolphinscheduler/3.2.2/apache-dolphinscheduler-3.2.2-src.tar.gz[root@master dolphinscheduler]# tar -xzvf ./apache-dolphinscheduler-3.2.2-src.tar.gz

2、修改Chart的镜像地址配置

(1)、修改Chart.yaml配置文件
repository: https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami改为repository: https://raw.gitmirror.com/bitnami/charts/archive-full-index/bitnami

[root@master dolphinscheduler]# cd /opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinscheduler[root@master dolphinscheduler]# vim Chart.yaml
# Application charts are a collection of templates that can be packaged into versioned archives# to be deployed.## Library charts provide useful utilities or functions for the chart developer. They're included as# a dependency of application charts to inject those utilities and functions into the rendering# pipeline. Library charts do not define any templates and therefore cannot be deployed.type: application# This is the chart version. This version number should be incremented each time you make changes# to the chart and its templates, including the app version.version: 3.3.0-alpha# This is the version number of the application being deployed. This version number should be# incremented each time you make changes to the application.appVersion: 3.3.0-alphadependencies:name: postgresql  version: 10.3.18  # Due to a change in the Bitnami repo, https://charts.bitnami.com/bitnami was truncated only  # containing entries for the latest 6 months (from January 2022 on).  # This URL: https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami  # contains the full 'index.yaml'.  # See detail here: https://github.com/bitnami/charts/issues/10833  #repositoryhttps://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami  repository: https://raw.gitmirror.com/bitnami/charts/archive-full-index/bitnami  condition: postgresql.enabledname: zookeeper  version: 6.5.3  # Same as above.  #repositoryhttps://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami  repository: https://raw.gitmirror.com/bitnami/charts/archive-full-index/bitnami  condition: zookeeper.enabledname: mysql  version: 9.4.1  #repositoryhttps://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami  repository: https://raw.gitmirror.com/bitnami/charts/archive-full-index/bitnami  condition: mysql.enabledname: minio  version: 11.10.13  #repositoryhttps://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami  repository: https://raw.gitmirror.com/bitnami/charts/archive-full-index/bitnami  condition: minio.enabled

(2)、执行helm更新
Chart.yaml配置文件修改完成后执行下面的命令:

[root@master dolphinscheduler]# helm repo add bitnami-full-index  https://raw.gitmirror.com/bitnami/charts/archive-full-index/bitnami[root@master dolphinscheduler]# helm repo add bitnami https://charts.bitnami.com/bitnami[root@master dolphinscheduler]# helm dependency update .

(3)、解压依赖文件
helm更新完成后,在当前目录会新生成【charts】目录,该目录下就是过helm更新下载到本地的依赖文件,如下图所示:

解压依赖包文件,因为本次安装除了Mysql都需要同步安装,所以要解压minio-11.10.13.tgzpostgresql-10.3.18.tgzzookeeper-6.5.3.tgz这几个压缩包

[root@master dolphinscheduler]# tar -zxvf minio-11.10.13.tgz[root@master dolphinscheduler]# tar -zxvf postgresql-10.3.18.tgz[root@master dolphinscheduler]# tar -zxvf zookeeper-6.5.3.tgz

3、修改Dolphinscheduler的Helm配置文件

cd /opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinschedulervim values.yaml

(1)、修改初始镜像
需要修改busybox和dolphinscheduler各个组件的镜像地址,修改后如下:

# -- World time and date for cities in all time zonestimezone: "Asia/Shanghai"# -- Used to detect whether dolphinscheduler dependent services such as database are readyinitImage:  # -- Image pull policy. Options: Always, Never, IfNotPresent  pullPolicy: "IfNotPresent"  # -- Specify initImage repository  #busybox"busybox:1.30.1"  busybox: "registry.cn-hangzhou.aliyuncs.com/docker_image-ljx/busybox:1.30.1"image:  # -- Docker image repository for the DolphinScheduler  registry: registry.cn-hangzhou.aliyuncs.com/docker_image-ljx  # -- Docker image version for the DolphinScheduler  tag: 3.2.2  # -- Image pull policy. Options: Always, Never, IfNotPresent  pullPolicy: "IfNotPresent"  # -- Specify a imagePullSecrets  pullSecret: ""  # -- master image  master: dolphinscheduler-master  # -- worker image  worker: dolphinscheduler-worker  # -- api-server image  api: dolphinscheduler-api  # -- alert-server image  alert: dolphinscheduler-alert-server  # -- tools image  tools: dolphinscheduler-tools

(2)、修改postgresql配置

  • 本文安装依赖的数据库配置了默认的数据库postgresql,参见配置datasource.profile: postgresql,但是values.yaml的默认配置中并没有配置postgresql镜像,会导致postgresql镜像拉取失败。
  • 本文dolphinscheduler依赖于bitnami postgresql的Chart,且已经在上一步 解压了。获取镜像地址的方式只需进入解压目录(/opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinscheduler/charts/postgresql)

查看postgresql的values.yaml(/opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinscheduler/charts/postgresql/values.yaml)找到镜像地址:

image:  registry: docker.io  repository: bitnami/postgresql  tag: 11.11.0-debian-10-r71  ## Specify a imagePullPolicy  ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'  ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images  ##  pullPolicy: IfNotPresent  ## Optionally specify an array of imagePullSecrets.  ## Secrets must be manually created in the namespace.  ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/  ##  # pullSecrets:  #   - myRegistryKeySecretName  ## Set to true if you would like to see extra information on logs  ## It turns BASH and/or NAMI debugging in the image  ##  debug: false

复制上述配置文件中的image配置信息,如下图所示:

将上步复制到image粘贴至/opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinscheduler/values.yaml配置文件中postgresql配置项下,如下所示:

datasource:  # -- The profile of datasource  profile: postgresqlpostgresql:  image:    registry: docker.io    repository: bitnami/postgresql    tag11.11.0-debian-10-r71  # -- If not exists external PostgreSQL, by default, the DolphinScheduler will use a internal PostgreSQL  enabled: true  # -- The username for internal PostgreSQL  postgresqlUsername"root"  # -- The password for internal PostgreSQL  postgresqlPassword"root"  # -- The database for internal PostgreSQL  postgresqlDatabase"dolphinscheduler"  # -- The driverClassName for internal PostgreSQL  driverClassName"org.postgresql.Driver"  # -- The params for internal PostgreSQL  params"characterEncoding=utf8"  persistence:    # -- Set postgresql.persistence.enabled to true to mount a new volume for internal PostgreSQL    enabled: false    # -- `PersistentVolumeClaim` size    size"20Gi"    # -- PostgreSQL data persistent volume storage class. If set to "-", storageClassName: "", which disables dynamic provisioning    storageClass"-"

(3)、修改minio配置
查看minio的values.yaml(/opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinscheduler/charts/minio/values.yaml)找到镜像地址:

image:  registry: docker.io  repository: bitnami/minio  tag: 2022.10.29-debian-11-r0  digest: ""  ## Specify a imagePullPolicy  ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'  ## ref: https://kubernetes.io/docs/user-guide/images/#pre-pulling-images  ##  pullPolicy: IfNotPresent  ## Optionally specify an array of imagePullSecrets.  ## Secrets must be manually created in the namespace.  ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/  ## e.g:  ## pullSecrets:  ##   - myRegistryKeySecretName  ##  pullSecrets: []  ## Set to true if you would like to see extra information on logs  ##  debug: false

复制上述配置文件中的image配置信息,如下图所示:

将上步复制到image粘贴至/opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinscheduler/values.yaml配置文件中minio配置项下,如下所示:

minio:  image:    registry: docker.io    repository: bitnami/minio    tag2022.10.29-debian-11-r0  # -- Deploy minio and configure it as the default storage for DolphinScheduler, note this is for demo only, not for production.  enabled: true  auth:    # -- minio username    rootUser: minioadmin    # -- minio password    rootPassword: minioadmin  persistence:    # -- Set minio.persistence.enabled to true to mount a new volume for internal minio    enabled: false  # -- minio default buckets  defaultBuckets"dolphinscheduler"

(4)、修改zookeeper配置
查看zookeeper的values.yaml(/opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinscheduler/charts/zookeeper/values.yaml)找到镜像地址:

image:  registry: docker.io  repository: bitnami/zookeeper  tag: 3.6.2-debian-10-r185  ## Specify a imagePullPolicy  ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'  ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images  ##  pullPolicy: IfNotPresent  ## Optionally specify an array of imagePullSecrets.  ## Secrets must be manually created in the namespace.  ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/  ##  # pullSecrets:  #   - myRegistryKeySecretName  ## Set to true if you would like to see extra information on logs  ## It turns BASH and/or NAMI debugging in the image  ##  debug: false

复制上述配置文件中的image配置信息,如下图所示:

将上步复制到image粘贴至/opt/dolphinscheduler/apache-dolphinscheduler-3.2.2-src/deploy/kubernetes/dolphinscheduler/values.yaml配置文件中zookeeper配置项下,如下所示:

zookeeper:  image:    registry: docker.io    repository: bitnami/zookeeper    tag3.6.2-debian-10-r185  # -- If not exists external registry, the zookeeper registry will be used by default.  enabled: true  service:    # -- The port of zookeeper    port2181  # -- A list of comma separated Four Letter Words commands to use  fourlwCommandsWhitelist"srvr,ruok,wchs,cons"  persistence:    # -- Set `zookeeper.persistence.enabled` to true to mount a new volume for internal ZooKeeper    enabled: false    # -- PersistentVolumeClaim size    size"20Gi"    # -- ZooKeeper data persistent volume storage class. If set to "-", storageClassName: "", which disables dynamic provisioning    storageClass"-"

(5)、修改master配置

master:  # -- Enable or disable the Master component  enabled: true  replicas: "1"  resources:    limits:      memory: "4Gi"      cpu: "4"    requests:      memory: "2Gi"      cpu: "500m"    persistentVolumeClaim:    # -- Set `worker.persistentVolumeClaim.enabled` to `true` to enable `persistentVolumeClaim` for `worker`    enabled: true    ## dolphinscheduler data volume    dataPersistentVolume:      # -- Set `worker.persistentVolumeClaim.dataPersistentVolume.enabled` to `true` to mount a data volume for `worker`      enabled: true      # -- `PersistentVolumeClaim` access modes      accessModes:      - "ReadWriteOnce"      # -- `Worker` data persistent volume storage class. If set to "-", storageClassName: "", which disables dynamic provisioning      storageClassName: "-"      # -- `PersistentVolumeClaim` size      storage: "20Gi"  env:    # -- The jvm options for master server    JAVA_OPTS: "-Xms1g -Xmx1g -Xmn512m"

(6)、修改worker配置
nfs-storage存储卷的创建
sc.yaml配置文件如下:

## 创建了一个存储类apiVersion: storage.k8s.io/v1kind: StorageClassmetadata:  name: nfs-storage  annotations:    storageclass.kubernetes.io/is-default-class: "true"provisioner: k8s-sigs.io/nfs-subdir-external-provisionerparameters:  archiveOnDelete: "true"  ## 删除pv的时候,pv的内容是否要备份---apiVersion: apps/v1kind: Deploymentmetadata:  name: nfs-client  labels:    app: nfs-client  # replace with namespace where provisioner is deployed  namespace: defaultspec:  replicas: 1  strategy:    type: Recreate  selector:    matchLabels:      app: nfs-client  template:    metadata:      labels:        app: nfs-client    spec:      serviceAccountName: nfs-client      containers:        - name: nfs-client          image: registry.cn-hangzhou.aliyuncs.com/lfy_k8s_images/nfs-subdir-external-provisioner:v4.0.2          # resources:          #    limits:          #      cpu: 10m          #    requests:          #      cpu: 10m          volumeMounts:            - name: nfs-client-root              mountPath: /persistentvolumes          env:            - name: PROVISIONER_NAME              value: k8s-sigs.io/nfs-subdir-external-provisioner            - name: NFS_SERVER              value: 192.168.255.140 ## 指定自己nfs服务器地址            - name: NFS_PATH                value: /data/nfsdata  ## nfs服务器共享的目录      volumes:        - name: nfs-client-root          nfs:            server: 192.168.255.140            path: /data/nfsdata---apiVersion: v1kind: ServiceAccountmetadata:  name: nfs-client  # replace with namespace where provisioner is deployed  namespace: default---kind: ClusterRoleapiVersion: rbac.authorization.k8s.io/v1metadata:  name: nfs-client-runnerrules:  - apiGroups: [""]    resources: ["nodes"]    verbs: ["get""list""watch"]  - apiGroups: [""]    resources: ["persistentvolumes"]    verbs: ["get""list""watch""create""delete"]  - apiGroups: [""]    resources: ["persistentvolumeclaims"]    verbs: ["get""list""watch""update"]  - apiGroups: ["storage.k8s.io"]    resources: ["storageclasses"]    verbs: ["get""list""watch"]  - apiGroups: [""]    resources: ["events"]    verbs: ["create""update""patch"]---kind: ClusterRoleBindingapiVersion: rbac.authorization.k8s.io/v1metadata:  name: run-nfs-clientsubjects:  - kind: ServiceAccount    name: nfs-client    # replace with namespace where provisioner is deployed    namespace: defaultroleRef:  kind: ClusterRole  name: nfs-client-runner  apiGroup: rbac.authorization.k8s.io---kind: RoleapiVersion: rbac.authorization.k8s.io/v1metadata:  name: leader-locking-nfs-client  # replace with namespace where provisioner is deployed  namespace: defaultrules:  - apiGroups: [""]    resources: ["endpoints"]    verbs: ["get""list""watch""create""update""patch"]---kind: RoleBindingapiVersion: rbac.authorization.k8s.io/v1metadata:  name: leader-locking-nfs-client  # replace with namespace where provisioner is deployed  namespace: defaultsubjects:  - kind: ServiceAccount    name: nfs-client    # replace with namespace where provisioner is deployed    namespace: defaultroleRef:  kind: Role  name: leader-locking-nfs-client  apiGroup: rbac.authorization.k8s.io

执行命令:

# 执行发布安装kubectl apply -f sc.yaml# 查看nfs-client-provisioner pod 是否安装成功kubectl get pod -A

Worker节点配置如下:

worker:  # -- Enable or disable the Worker component  enabled: true  replicas: "1"  resources:    limits:      memory: "4Gi"      cpu: "2"    requests:      memory: "2Gi"      cpu: "500m"    persistentVolumeClaim:    # -- Set `worker.persistentVolumeClaim.enabled` to `true` to enable `persistentVolumeClaim` for `worker`    enabled: true    ## dolphinscheduler data volume    dataPersistentVolume:      # -- Set `worker.persistentVolumeClaim.dataPersistentVolume.enabled` to `true` to mount a data volume for `worker`      enabled: true      # -- `PersistentVolumeClaim` access modes      accessModes:      - "ReadWriteOnce"      # -- `Worker` data persistent volume storage class. If set to "-", storageClassName: "", which disables dynamic provisioning      storageClassName: "nfs-storage"      # -- `PersistentVolumeClaim` size      storage: "20Gi"  env:    # -- The jvm options for master server    JAVA_OPTS: "-Xms1g -Xmx1g -Xmn512m"

(6)、修改alter配置

alert:  # -- Enable or disable the Worker component  enabled: true  replicas: "1"  resources:    limits:      memory: "2Gi"      cpu: "1"    requests:      memory: "1Gi"      cpu: "500m"  persistentVolumeClaim:    # -- Set `worker.persistentVolumeClaim.enabled` to `true` to enable `persistentVolumeClaim` for `worker`    enabled: true    ## dolphinscheduler data volume    dataPersistentVolume:      # -- Set `worker.persistentVolumeClaim.dataPersistentVolume.enabled` to `true` to mount a data volume for `worker`      enabled: true      # -- `PersistentVolumeClaim` access modes      accessModes:      - "ReadWriteOnce"      # -- `Worker` data persistent volume storage class. If set to "-", storageClassName: "", which disables dynamic provisioning      storageClassName: "-"      # -- `PersistentVolumeClaim` size      storage: "20Gi"  env:    # -- The jvm options for master server    JAVA_OPTS: "-Xms1g -Xmx1g -Xmn512m"

3、执行安装

(1)、安装前检查

[root@master dolphinscheduler]# helm template dolphinscheduler -f values.yaml ./

(2)、安装

[root@master dolphinscheduler]# kubectl create namespace dolphinscheduler[root@master dolphinscheduler]# helm -n dolphinscheduler  install dolphinscheduler -f values.yaml  ./

(3)、查看安装进度

[root@master dolphinscheduler]# kubectl get all -n dolphinscheduler

(4)、添加ingress配置实现访问ui



【重点】
配置完成后,Dolphinscheduler管理端的UI访问地址为: http://dolphinscheduler.tyzwkj.cn/dolphinscheduler/ui/。

但是此时由于dolphinscheduler.tyzwkj.cn自定义域名还不能自动解析,需要在本地hosts文件中添加路由后才可以访问。

4、登录

配置完hosts后在浏览器中输入http://dolphinscheduler.tyzwkj.cn/dolphinscheduler/ui/
用户名:admin
密码:dolphinscheduler123

结束,以上就是通过k8s部署Apache Dolphinscheduler集群的全部内容。

原文链接:https://blog.csdn.net/dyj095/article/details/150106792






用户案例



天翼云Zoom网易邮箱 
每日互动 惠生工程  作业帮 
博世智驾 蔚来汽车 长城汽车
集度长安汽车思科网讯
食行生鲜联通医疗联想
新网银行唯品富邦消费金融 
自如有赞伊利当贝大数据
珍岛集团传智教育Bigo
YY直播  拈花云科太美医疗
Cisco Webex兴业证券




迁移实战



Azkaban   Ooize(当贝迁移案例)
Airflow (有赞迁移案例)
Air2phin(迁移工具)
Airflow迁移实践



发版消息




Apache DolphinScheduler 3.2.2版本正式发布!
Apache DolphinScheduler 3.2.1 版本发布:增强功能与安全性的全面升级
Apache DolphinScheduler 3.3.0 Alpha发布,功能增强与性能优化大升级!




加入社区



关注社区的方式有很多:

  • GitHub: https://github.com/apache/dolphinscheduler
  • 官网:https://dolphinscheduler.apache.org/en-us
  • 订阅开发者邮件:dev@dolphinscheduler@apache.org
  • X.com:@DolphinSchedule
  • YouTube:https://www.youtube.com/@apachedolphinscheduler
  • Slack:https://join.slack.com/t/asf-dolphinscheduler/shared_invite/zt-1cmrxsio1-nJHxRJa44jfkrNL_Nsy9Qg

同样地,参与Apache DolphinScheduler 有非常多的参与贡献的方式,主要分为代码方式和非代码方式两种。

📂非代码方式包括:

完善文档、翻译文档;翻译技术性、实践性文章;投稿实践性、原理性文章;成为布道师;社区管理、答疑;会议分享;测试反馈;用户反馈等。

👩‍💻代码方式包括:

查找Bug;编写修复代码;开发新功能;提交代码贡献;参与代码审查等。

贡献第一个PR(文档、代码) 我们也希望是简单的,第一个PR用于熟悉提交的流程和社区协作以及感受社区的友好度。

社区汇总了以下适合新手的问题列表https://github.com/apache/dolphinscheduler/pulls?q=is%3Apr+is%3Aopen+label%3A%22first+time+contributor%22

优先级问题列表https://github.com/apache/dolphinscheduler/pulls?q=is%3Apr+is%3Aopen+label%3Apriority%3Ahigh

如何参与贡献链接https://dolphinscheduler.apache.org/zh-cn/docs/3.2.2/%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97_menu/%E5%A6%82%E4%BD%95%E5%8F%82%E4%B8%8E_menu

如果你❤️小海豚,就来为我点亮Star吧!

https://github.com/apache/dolphinscheduler


你的好友秀秀子拍了拍你

并请你帮她点一下“分享”

【声明】内容源于网络
0
0
海豚调度
Apache DolphinScheduler是一个分布式、去中心化、易扩展的可视化DAG工作流任务调度系统,其致力于解决数据处理流程中错综复杂的依赖关系,使调度系统在数据处理流程中开箱即用。
内容 0
粉丝 0
海豚调度 Apache DolphinScheduler是一个分布式、去中心化、易扩展的可视化DAG工作流任务调度系统,其致力于解决数据处理流程中错综复杂的依赖关系,使调度系统在数据处理流程中开箱即用。
总阅读0
粉丝0
内容0