在k8s上部署dolphinscheduler

(作者:陈玓玏)

一、 前提条件

  1. 已部署k8s,版本信息如下:
  2. k8s为单机部署;
  3. 已部署nfs,版本如下;

二、 部署helm

以下步骤安装的是二进制版本,如果通过脚本安装,可以直接参考链接:https://helm.sh/docs/intro/install/。

1.下载helm,地址:https://github.com/helm/helm/releases,通过wget下载。这里碰到一个错误,下载到最后四秒时报错,helm文件带\*号,不可用,网络问题,重新下载;

2.解压,tar -zxvf helm-v3.14.2-linux-amd64.tar.gz;

3.把文件移至指定位置,mv linux-amd64/helm /usr/local/bin/helm;

4.验证是否安装成功,输入helm version,能查看到版本即可。

三、安装dolphinscheduler

1.下载安装包,下载地址:https://dolphinscheduler.apache.org/zh-cn/download/3.1.8,通过命令wget -c https://archive.apache.org/dist/dolphinscheduler/3.1.8/apache-dolphinscheduler-3.1.8-src.tar.gz下载;

2.按序执行以下代码:

复制代码
tar -zxvf apache-dolphinscheduler-<version>-src.tar.gz
cd apache-dolphinscheduler-<version>-src/deploy/kubernetes/dolphinscheduler
helm repo add bitnami https://charts.bitnami.com/bitnami
  1. 更新依赖:helm dependency update .
    注意,执行helm dependency update .前,最好把Chart.yaml中的三个repository: https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami改成repository: https://raw.gitmirror.com/bitnami/charts/archive-full-index/bitnami,避免连不上外网导致下载不到依赖。

碰到的bug:

3.1. helm dependency update .碰到bug:Chart.yaml file is missing,因为没进入正确的路径,少cd了两层;

3.2. helm dependency update .碰到bug:Save error occurred: could not find : chart postgresql not found in https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami: looks like "https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami" is not a valid chart repository or cannot be reached: context deadline exceeded (Client.Timeout or context cancellation while reading body),应该是服务器不通github或者链接github的网速太慢。尝试解决,先在https://www.ip138.com/查找github.com的ip地址,然后在服务器的/etc/hosts中加入一行,ip github.com,再尝试helm dependency update .最后解决方法是更改Chart.yaml的地址,把repository: https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami改成repository: https://raw.gitmirror.com/bitnami/charts/archive-full-index/bitnami。

  1. 修改存储类型

    修改 values.yaml 文件中下面的配置项,将resource.storage.type改为NONE,common中的configmap中新增RESOURCE_STORAGE_TYPE: "NONE"和FS_DEFAULT_FS: "file:///",common的fsFileResourcePersistence改enabled: true,storageClassName: "nfs-storage".

    主要修改的内容如下图:

  2. 部署dolphinscheduler:helm install dolphinscheduler . --set image.tag=<version>

碰到的Bug:

5.1 一开始没进行第四步,默认用的是hdfs存储,一直报错postgresql的secret不存在,重新执行了第4步就好了;

5.2 报错连接postgresql失败,账号密码有误,排查应该是我之前用k8s部署过了postgresql和mysql等,账号密码已经在configmap中设置过了,所以dolphinscheduler用新的账号密码连不上,删除原来的postgresql、mysql、zookeeper的部署,重新执行helm部署dolphinscheduler就解决了;

5.3 报错0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.这里应该是我设置了存储类型中的storageClassName: "nfs-storage",但实际我的集群中没有这个storageClassName,所以pod和pvc、pv绑定失败。

为了解决Bug5.3,新建一个pv:

复制代码
kind: PersistentVolume
apiVersion: v1
metadata:
  name: nfs-storage
  labels:
    app: nfs
    type: local

spec:
  capacity:
    storage: 20Gi
  hostPath:
    path: /home/data
    type: ''
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: nfs-storage
  volumeMode: Filesystem

pod全部正常运行了。

  1. 访问,在k8sdashboard上找到名为dolphinscheduler-api的service,编辑yaml文件,把类型从ClusterIP改为NodePort,访问ip+端口+/dolphinscheduler/ui,默认的用户是admin,默认的密码是dolphinscheduler123,可进入dolphinscheduler,表示部署成功。

参考文章:

https://blog.csdn.net/weixin_64348970/article/details/134368824

https://blog.csdn.net/qq_41538097/article/details/125380287

相关推荐
风曦Kisaki1 小时前
对象存储 MinIO 的两种生产环境适用部署方式
kubernetes
名字还没想好☜2 小时前
Kubernetes NetworkPolicy 实战:默认全通的坑与用标签做零信任隔离
运维·云原生·容器·kubernetes·networkpolicy
Crazy________2 小时前
Redis02:库切换、监控与安全配置
linux·redis·云原生·mybatis
ai_coder_ai4 小时前
平台工程(Platform Engineering)在企业数字化中的应用
云原生
云烟成雨TD4 小时前
Micrometer 系列【28】Spring Boot Actuator | 其他指标速览
java·spring boot·云原生
人间凡尔赛4 小时前
Kubernetes Gateway API 1.4 全面 GA:2026 年云原生流量治理的下一代标准
后端·云原生·架构
风曦Kisaki5 小时前
# Kubernetes(K8s)笔记Day13 :工作负载资源概述与 Job (CronJob)控制器
linux·笔记·云原生·容器·kubernetes
Patrick在香港14 小时前
Python Docker镜像从1.2GB到89MB:多阶段构建的完整优化实录
java·python·docker·信息可视化·容器·数据分析·ai编程
风曦Kisaki20 小时前
# Kubernetes(K8s)笔记Day12 :K8s 七层代理(Ingress 和 Ingress Controller)
linux·笔记·云原生·容器·kubernetes
雨辰AI1 天前
达梦 DM9 K8s 密评合规部署|等保三级 + 密评双标准安全加固(金融级实测通过)
安全·云原生·容器·金融·kubernetes·政务