Dolphinscheduler1.3.6 k8s部署文档

Dolphinscheduler1.3.6 部署文档

环境

Helm 2.1.6
Kubernetes 1.12+

Dockerfile创建:

#编写dockerfile,将开发所需的安装包和版本全都打入镜像中
FROM apache/dolphinscheduler:latest
RUN sed -i 's# http://deb.debian.org/debian/#http://mirrors.tuna.tsinghua.edu.cn/#' /etc/apt/sources.list
RUN apt-get update && apt-get install -y vim
RUN apt-get update \
    && apt-get install -y tar git curl nano wget dialog net-tools build-essential \
    && apt-get install --no-install-recommends -y -q python3 python3-pip python3-dev \
    && apt-get install -y libxml2-dev libxslt-dev python-dev zlib1g-dev
RUN python3 -m pip install --upgrade --force-reinstall pip
RUN python3 -m pip install setuptools
RUN python3 -m pip install aiohttp==3.7.4.post0
RUN python3 -m pip install async-timeout==3.0.1
RUN python3 -m pip install attrs==21.2.0
RUN python3 -m pip install Automat==20.2.0
RUN python3 -m pip install beautifulsoup4==4.9.3
RUN python3 -m pip install bs4==0.0.1
RUN python3 -m pip install certifi==2021.5.30
RUN python3 -m pip install cffi==1.14.5
RUN python3 -m pip install chardet==4.0.0
RUN python3 -m pip install constantly==15.1.0
RUN python3 -m pip install cryptography==3.4.7
RUN python3 -m pip install cssselect==1.1.0
RUN python3 -m pip install DBUtils==2.0.1
RUN python3 -m pip install et-xmlfile==1.1.0
RUN python3 -m pip install h2==3.2.0
RUN python3 -m pip install hpack==3.0.0
RUN python3 -m pip install hyperframe==5.2.0
RUN python3 -m pip install hyperlink==21.0.0
RUN python3 -m pip install idna==2.10
RUN python3 -m pip install incremental==21.3.0
RUN python3 -m pip install itemadapter==0.2.0
RUN python3 -m pip install itemloaders==1.0.4
RUN python3 -m pip install jmespath==0.10.0
RUN python3 -m pip install lxml==4.6.3
RUN python3 -m pip install multidict==5.1.0
RUN python3 -m pip install multipart==0.2.4
RUN python3 -m pip install openpyxl==3.0.7
RUN python3 -m pip install parsel==1.6.0
RUN python3 -m pip install persistent==4.7.0
RUN python3 -m pip install priority==1.3.0
RUN python3 -m pip install Protego==0.1.16
RUN python3 -m pip install pyasn1==0.4.8
RUN python3 -m pip install pyasn1-modules==0.2.8
RUN python3 -m pip install pycparser==2.20
RUN python3 -m pip install PyDispatcher==2.0.5
RUN python3 -m pip install PyExecJS==1.5.1
RUN python3 -m pip install pymongo==3.11.4
RUN python3 -m pip install PyMySQL==1.0.2
RUN python3 -m pip install pyOpenSSL==20.0.1
RUN python3 -m pip install python-gettext==4.0
RUN python3 -m pip install pytz==2021.1
RUN python3 -m pip install queuelib==1.6.1
RUN python3 -m pip install redis==3.5.3
RUN python3 -m pip install requests==2.25.1
RUN python3 -m pip install Scrapy==2.5.0
RUN python3 -m pip install selenium==3.141.0
RUN python3 -m pip install service-identity==21.1.0
RUN python3 -m pip install six==1.16.0
RUN python3 -m pip install soupsieve==2.2.1
RUN python3 -m pip install transaction==3.0.1
RUN python3 -m pip install Twisted==21.2.0
RUN python3 -m pip install typing-extensions==3.10.0.0
RUN python3 -m pip install urllib3==1.26.5
RUN python3 -m pip install w3lib==1.22.0
RUN python3 -m pip install yarl==1.6.3
RUN python3 -m pip install zope.browser==2.3
RUN python3 -m pip install zope.component==5.0.0
RUN python3 -m pip install zope.configuration==4.4.0
RUN python3 -m pip install zope.contenttype==4.5.0
RUN python3 -m pip install zope.deprecation==4.4.0
RUN python3 -m pip install zope.event==4.5.0
RUN python3 -m pip install zope.exceptions==4.4
RUN python3 -m pip install zope.hookable==5.0.1
RUN python3 -m pip install zope.i18n==4.7.0
RUN python3 -m pip install zope.i18nmessageid==5.0.1
RUN python3 -m pip install zope.interface==5.4.0
RUN python3 -m pip install zope.location==4.2
RUN python3 -m pip install zope.proxy==4.3.5
RUN python3 -m pip install zope.publisher==6.0.1
RUN python3 -m pip install zope.schema==6.1.0
RUN python3 -m pip install zope.security==5.1.1
RUN python3 -m pip install zope.tal==4.5
RUN python3 -m pip install zope.tales==5.1
RUN python3 -m pip install zope.traversing==4.4.1   
​
#build
docker build -t  registry-vpc.cn-zhangjiakou.aliyuncs.com/sinocarbon/dolphinscheduler:1.3.6-SNAPSHOT .#推送到远程仓库
docker push registry-vpc.cn-zhangjiakou.aliyuncs.com/sinocarbon/dolphinscheduler:1.3.6-SNAPSHOT

名称空间创建:

#dev环境 到/createNamspace 文件夹下有现成的的模板
#namespace:dolps
apiVersion: v1
kind: Namespace
metadata:
  name: dolps
  labels:
    istio-injection: enabled
​
---
​
apiVersion: v1
kind: LimitRange
metadata:
  name: default-resources
  namespace: dolps
spec:
  limits:
  - default:
      cpu: 2000m
      memory: 2000Mi
    defaultRequest:
      cpu: 170m
      memory: 350Mi
    type: Container

PV创建:

#由于要挂载PV PVC  所以要创建
#dolps.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: dolps-pv
  labels:
    pv: dolps-pv
spec:
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    path: /nfs/data/dev/dol_test
    server: 9aaad4a37a-sgj63.cn-zhangjiakou.nas.aliyuncs.com 
​
---
​
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: dolps-pvc
  namespace: dolps
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Mi
  selector:
    matchLabels:
      pv: dolps-pv
​

安装dolphinscheduler

#下载源码包apache-dolphinscheduler-1.3.6-src.tar.gz,下载地址: https://dolphinscheduler.apache.org/zh-cn/download/download.html
#发布一个名为 dolphinscheduler 的版本(release),请执行以下命令:
$ tar -zxvf apache-dolphinscheduler-1.3.6-src.tar.gz
$ cd apache-dolphinscheduler-1.3.6-src/docker/kubernetes/dolphinscheduler
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm dependency update .  #执行到这一步时候会报错,报缺少requirements文件,我们去1.3.4版本拷贝过来就好了(因为服务器上是helm2版本,要是helm 3版本就不会出现这样的问题)
$ helm install --name dolphinscheduler . --namespace dolps #安装
$ helm del --purge dolphinscheduler #卸载
访问DolphinScheduler 前端页面
#设置api.service.type=NodePort,执行安装后下面会提示你操作如下命令
NODE_IP=$(kubectl get no -n {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
NODE_PORT=$(kubectl get svc {{ template "dolphinscheduler.fullname" . }}-api -n {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}")
echo http://$NODE_IP:$NODE_PORT/dolphinscheduler
#之后会出现IP+端口  端口需要通知运维到安全组里添加#也可以设置api.service.type=ClusterIP,执行下面命令
 kubectl port-forward --address 0.0.0.0 -n dolps svc/dolphinscheduler-api 12345:12345 # 使用 dolps 命名空间
#但是有个问题,但我们退出服务器时,12345端口自动消亡
#因此推荐使用 nodeportip

文件修改

value.yaml
1.首先到value.yaml 文件中修改 image:
image:
  repository: "apache/dolphinscheduler"  #你自己制作的镜像
  tag: "latest"                          #制作镜像时设置的标签
  pullPolicy: "IfNotPresent"
  pullSecret: "tiger"                    #拉取镜像的密钥,这边填写不对会报错
  
2.postgresql 是建在外部的,因此false
externalDatabase:
  type: "postgresql"
  driver: "org.postgresql.Driver"
  host: "localhost"                #填写你的数据库IP地址
  port: "5432"                     
  username: "root"                 #账号
  password: "root"                 #密码
  database: "dolphinscheduler"     #数据库名
  params: "characterEncoding=utf8"
  
  
3.Zookeeper 建立在外部的
externalZookeeper:
  zookeeperQuorum: "127.0.0.1:2181"     #你自建的zookeeper地址
  zookeeperRoot: "/dolphinscheduler"
  
修改成这样:
externalZookeeper:
  taskQueue: "zookeeper"
  zookeeperQuorum: "zookeeper.basic.svc.cluster.local:2181"
不然会报如下错:
Trying to connect to zookeeper at 127.0.0.1:2181. Attempt 1
​
4.service  关系到你是如何访问的
service:
    ## type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer
    type: "ClusterIP"   #修改成NodePort
    ## clusterIP is the IP address of the service and is usually assigned randomly by the master
    clusterIP: ""
    ## nodePort is the port on each node on which this service is exposed when type=NodePort
    nodePort: "" #第一次启动后 使用nodeport命令出来的端口号,填写到这里,起到固定的作用
    
    
 5.打开 statefulset-dolphinscheduler-worker.yaml 
  volumes:
        - name: {{ include "dolphinscheduler.fullname" . }}-worker-data
          {{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }}
          persistentVolumeClaim:
            claimName: {{ include "dolphinscheduler.fullname" . }}-worker-data
修改成:你创建好的pvc名字
 volumes:
        - name: {{ include "dolphinscheduler.fullname" . }}-worker-data
          {{- if .Values.worker.persistentVolumeClaim.dataPersistentVolume.enabled }}
          persistentVolumeClaim:
            claimName: dolps-pvc

你可能感兴趣的:(k8s)