温故知新
- ⁉️问题记录
- ❓问题一:`Unschedulable 0/3 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: 0/3 nodes are available: 3 No preemption victims found for incoming pod..`
- ❗解决方式:创建PV供应
- 📗安装NFS
- 📗PV(配置文件、生效、状态查看)
- 📗卸载重装dolphinscheduler
- 📗手动关联pv和pvc
- ❓问题二:容器未就绪/容器组未就绪
- ❗单独安装数据库
- ❗修改values.yaml
- ❗添加mysql驱动
- ❗重新安装调度
- ❓其他
- ❗docker命令
- ❗helm、kubectl相关命令
🔼上一集:在Kubernetes集群中部署 dolphindcheduler-3.1.8
*️⃣主目录:温故知新专栏
⁉️问题记录
❓问题一:Unschedulable 0/3 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: 0/3 nodes are available: 3 No preemption victims found for incoming pod..
❗解决方式:创建PV供应
📗安装NFS
集群安装NFS,r1作为服务器,r2,r3只需安装客户端,具体可参照dolphinscheduler 2.0.6 资源中心改造方案二:通过NFS挂载共享目录
安装nfs(所有机器)
yum install -y rpcbind nfs-utils
r1/服务器上执行相关配置
[root@renxiaozhao01 ~]# mkdir -p /data/nfs
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# vi /etc/exports
[root@renxiaozhao01 ~]# cat /etc/exports
/data/nfs 192.168.17.0/24(rw,sync,no_root_squash)
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# systemctl start nfs-server.service
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# showmount -e
Export list for renxiaozhao01:
/data/nfs 192.168.17.0/24
[root@renxiaozhao01 ~]#
📗PV(配置文件、生效、状态查看)
[kubernetes@renxiaozhao01 dolphinscheduler]$ cat pg_pv.yaml
#Kubernetes的API版本
apiVersion: v1
kind: PersistentVolume
metadata:
name: pgsqlpv
spec:
capacity:
storage: 10Gi
#指定访问模式
accessModes:
#pv能以readwrite模式mount到单个节点
- ReadWriteOnce
#指定pv的回收策略,即pvc资源释放后的事件.recycle(不建议,使用动态供给代替)删除pvc的所有文件
persistentVolumeReclaimPolicy: Recycle
#可以随意指定存储类的名称,只要确保在创建PVC时使用相同的名称即可
storageClassName: pgsqlnfs
#指定pv为nfs服务器上对应的目录
nfs:
path: /data/nfs
server: 192.168.17.17
[kubernetes@renxiaozhao01 dolphinscheduler]$ kubectl apply -f pg_pv.yaml
persistentvolume/pgsqlpv created
[kubernetes@renxiaozhao01 dolphinscheduler]$ kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pgsqlpv 10Gi RWO Recycle Available pgsqlnfs 15s
[kubernetes@renxiaozhao01 dolphinscheduler]$
📗卸载重装dolphinscheduler
通过helm
卸载,kubectl delete pvc
删除之前的pgsql存储
[kubernetes@renxiaozhao01 dolphinscheduler]$ helm uninstall dolphinscheduler
release "dolphinscheduler" uninstalled
[kubernetes@renxiaozhao01 dolphinscheduler]$ kubectl delete pvc -l app.kubernetes.io/instance=dolphinscheduler
persistentvolumeclaim "data-dolphinscheduler-postgresql-0" deleted
[kubernetes@renxiaozhao01 dolphinscheduler]$
[kubernetes@renxiaozhao01 dolphinscheduler]$
[kubernetes@renxiaozhao01 dolphinscheduler]$ helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
[kubernetes@renxiaozhao01 dolphinscheduler]$ kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
pgsqlpvc Bound pgsqlpv 10Gi RWO pgsqlnfs 16m
[kubernetes@renxiaozhao01 dolphinscheduler]$
[kubernetes@renxiaozhao01 dolphinscheduler]$
修改配置文件values.yaml,指定pgsql的storageClass: "pgsqlpvc"
pvc参考范例
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pgsqlpvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: pgsqlnfs
[kubernetes@renxiaozhao01 dolphinscheduler]$ pwd
/home/kubernetes/apache-dolphinscheduler-3.1.8-src/deploy/kubernetes/dolphinscheduler
[kubernetes@renxiaozhao01 dolphinscheduler]$ ll
总用量 48
-rwxr-xr-x 1 kubernetes kubernetes 396 9月 14 20:35 Chart.lock
drwxr-xr-x 2 kubernetes kubernetes 88 9月 14 20:35 charts
-rwxr-xr-x 1 kubernetes kubernetes 3333 9月 14 20:10 Chart.yaml
-rwxr-xr-x 1 kubernetes kubernetes 2905 2月 18 2022 Chart.yaml_bak
-rw-rw-r-- 1 kubernetes kubernetes 187 9月 18 19:16 pg_pvc.yaml
-rw-rw-r-- 1 kubernetes kubernetes 621 9月 18 19:14 pg_pv.yaml
drwxr-xr-x 3 kubernetes kubernetes 20 2月 18 2022 resources
drwxr-xr-x 2 kubernetes kubernetes 4096 9月 14 20:27 templates
-rwxr-xr-x 1 kubernetes kubernetes 21534 9月 18 19:39 values.yaml
[kubernetes@renxiaozhao01 dolphinscheduler]$
[kubernetes@renxiaozhao01 dolphinscheduler]$ vi values.yaml
也不知道啥原因,有懂的欢迎指点
📗手动关联pv和pvc
试了好久,还是报Unschedulable 0/3 nodes are available...
,最初通过手动关联pv和pvc,错误消失了,但是依然没有成功,还是有其他错
#Kubernetes的API版本
apiVersion: v1
kind: PersistentVolume
metadata:
name: pgsqlpv
spec:
capacity:
storage: 20Gi
#指定访问模式
accessModes:
#pv能以readwrite模式mount到单个节点
- ReadWriteOnce
#指定pv的回收策略,即pvc资源释放后的事件.recycle(不建议,使用动态供给代替)删除pvc的所有文件
persistentVolumeReclaimPolicy: Recycle
#可以随意指定存储类的名称,只要确保在创建PVC时使用相同的名称即可
storageClassName: pgsqlnfs
#指定pv为nfs服务器上对应的目录
claimRef:
kind: PersistentVolumeClaim
namespace: default
name: data-dolphinscheduler-postgresql-0
nfs:
path: /data/nfs
server: 192.168.17.17
但是…
❓问题二:容器未就绪/容器组未就绪
❗单独安装数据库
单独安装数据库吧,采用MySQL数据库
📗下载镜像
[root@renxiaozhao01 ~]# docker pull mysql:8.0.25
8.0.25: Pulling from library/mysql
b4d181a07f80: Pull complete
a462b60610f5: Pull complete
578fafb77ab8: Pull complete
524046006037: Pull complete
d0cbe54c8855: Pull complete
aa18e05cc46d: Pull complete
32ca814c833f: Pull complete
9ecc8abdb7f5: Pull complete
ad042b682e0f: Pull complete
71d327c6bb78: Pull complete
165d1d10a3fa: Pull complete
2f40c47d0626: Pull complete
Digest: sha256:52b8406e4c32b8cf0557f1b74517e14c5393aff5cf0384eff62d9e81f4985d4b
Status: Downloaded newer image for mysql:8.0.25
docker.io/library/mysql:8.0.25
[root@renxiaozhao01 ~]#
📗启动mysql
[root@renxiaozhao01 ~]# docker run -itd --name dolphinscheduler -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql:8.0.25
be0182b0b1459c15ac38c9f8f4704f4a0c56d6aebd737544111d7dc2d9f47750
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]#
📗验证数据库
[root@renxiaozhao01 ~]# docker ps -a -f name=dolphinscheduler
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
be0182b0b145 mysql:8.0.25 "docker-entrypoint.s…" 22 seconds ago Up 21 seconds 0.0.0.0:3306->3306/tcp, 33060/tcp dolphinscheduler
[root@renxiaozhao01 ~]#
📗初始化数据库
创建数据库dolphinscheduler
CREATE DATABASE dolphinscheduler;
执行初始化脚本apache-dolphinscheduler-3.1.8-src/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql
❗修改values.yaml
📗关闭pgsql
开关,指定外部数据库为mysql
(详见官网)
❗添加mysql驱动
mysql-connector-java-8.0.25.jar下载
📗制作包含mysql驱动的api镜像
[root@renxiaozhao01 ~]# ll mysql-connector-java-8.0.25.jar
-rw-r--r-- 1 root root 2428320 9月 19 21:57 mysql-connector-java-8.0.25.jar
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# vi dockerfile
[root@renxiaozhao01 ~]# cat dockerfile
FROM dolphinscheduler.docker.scarf.sh/apache/dolphinscheduler-api:3.1.8
COPY mysql-connector-java-8.0.25.jar /opt/dolphinscheduler/libs
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# docker build -t apache/dolphinscheduler-api:mysql-driver .
[+] Building 0.6s (7/7) FINISHED docker:default
=> [internal] load build definition from dockerfile 0.0s
=> => transferring dockerfile: 175B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for dolphinscheduler.docker.scarf.sh/apache/dolphinscheduler-api:3.1.8 0.0s
=> [internal] load build context 0.1s
=> => transferring context: 2.43MB 0.1s
=> CACHED [1/2] FROM dolphinscheduler.docker.scarf.sh/apache/dolphinscheduler-api:3.1.8 0.0s
=> [2/2] COPY mysql-connector-java-8.0.25.jar /opt/dolphinscheduler/libs 0.1s
=> exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:b16232cf8dd31fbbfd1ed035b8b0fc32093d8b8eb5adc53472db039a0aeae450 0.0s
=> => naming to docker.io/apache/dolphinscheduler-api:mysql-driver 0.0s
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# docker tag apache/dolphinscheduler-api:mysql-driver registry:5000/apache/dolphinscheduler-api:mysql-driver
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
apache/dolphinscheduler-api mysql-driver b16232cf8dd3 2 minutes ago 443MB
registry:5000/apache/dolphinscheduler-api mysql-driver b16232cf8dd3 2 minutes ago 443MB
❗重新安装调度
参照之前的卸载重装,安装官网提示修改,再次安装
虽然还是不成功,但是点击追踪日志可以进入到服务器内部了,说明容器部署成功了,但是服务没起来,没起来原因是zk连接超时
进入zk
终端,通过测试连接(zkCli.sh -server 192.168.17.17:2181
),连接没问题,将values.yaml
的zk
地址改为具体的地址,再次重装重试(无效 不用试了!!!)
values.yaml
添加servers: "192.168.17.17:2181"
[kubernetes@renxiaozhao01 dolphinscheduler]$ vi values.yaml
[kubernetes@renxiaozhao01 dolphinscheduler]$ grep 2181 values.yaml
port: 2181
registryServers: "192.168.17.17:2181"
[kubernetes@renxiaozhao01 dolphinscheduler]$
[kubernetes@renxiaozhao01 dolphinscheduler]$ # 卸载
[kubernetes@renxiaozhao01 dolphinscheduler]$ helm uninstall dolphinscheduler
release "dolphinscheduler" uninstalled
[kubernetes@renxiaozhao01 dolphinscheduler]$ # 安装
[kubernetes@renxiaozhao01 dolphinscheduler]$ helm install dolphinscheduler . --set image.tag=mysql-driver
NAME: dolphinscheduler
LAST DEPLOYED: Tue Sep 19 23:05:56 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
** Please be patient while the chart DolphinScheduler 3.1.8 is being deployed **
Access DolphinScheduler UI URL by:
kubectl port-forward -n default svc/dolphinscheduler-api 12345:12345
DolphinScheduler UI URL: http://127.0.0.1:12345/dolphinscheduler
[kubernetes@renxiaozhao01 dolphinscheduler]$
心好累…不再钻牛角尖了,后面决定尝试一下自己打镜像,就是把调度代码数据库什么的全被配置好后,打成镜像,如何通过Kuboard界面化去部署(估计要等一段时间了,为了四十多天要忙其他事了)
❓其他
❗docker命令
📗查看状态、日志
[root@renxiaozhao01 ~]# docker ps -a -f name=dolphinscheduler
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2c1365a3424a mysql:8.0.25 "docker-entrypoint.s…" 5 minutes ago Exited (1) 5 minutes ago dolphinscheduler
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# docker logs -f 2c1365a3424a
2023-09-19 13:12:18+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.25-1debian10 started.
2023-09-19 13:12:19+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-09-19 13:12:19+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.25-1debian10 started.
2023-09-19 13:12:19+00:00 [Note] [Entrypoint]: Initializing database files
2023-09-19T13:12:19.463251Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.25) initializing of server in progress as process 42
2023-09-19T13:12:19.484175Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-09-19T13:12:21.091291Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-09-19T13:12:26.189395Z 0 [ERROR] [MY-000068] [Server] unknown option '--restart'.
2023-09-19T13:12:26.190438Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2023-09-19T13:12:26.192449Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-09-19T13:12:28.096322Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.25) MySQL Community Server - GPL.
[root@renxiaozhao01 ~]#
📗停止删除容器
[root@renxiaozhao01 ~]# docker stop dolphinscheduler
dolphinscheduler
[root@renxiaozhao01 ~]#
[root@renxiaozhao01 ~]# docker rm -v dolphinscheduler
dolphinscheduler
[root@renxiaozhao01 ~]#
❗helm、kubectl相关命令
📗helm
卸载安装命令
helm uninstall dolphinscheduler
helm install dolphinscheduler . --set image.tag=mysql-driver
📗kubectl
删除pod、pv、pvc命令
带上--force --grace-period=0
代码强制删除
kubectl delete pod dolphinscheduler-postgresql-0 --force --grace-period=0
kubectl delete pvc -l app.kubernetes.io/instance=dolphinscheduler --force --grace-period=0
kubectl delete pv pgsqlpv --force --grace-period=0