在k8s集群部署jenkins遇到的问题
1.部署完之后pod起不来
kubectl describe pod jenkins-74b4c59549-lm6qj -n jenkins-k8s
原因:
node2节点没安装nfs-utils,导致挂载pvc失败
解决办法:
在node2节点执行
yum install -y nfs-utils
systemctl start nfs
systemctl enable nfs
2.启动状态不正常
[root@master1 ~]# kubectl logs jenkins-74b4c59549-5r2k6 -n jenkins-k8s
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
权限不够
[root@master1 ~]# chown -R 1000.1000 /data/v2
[root@master1 ~]# kubectl delete -f jenkins-deployment.yaml
deployment.apps "jenkins" deleted
[root@master1 ~]# kubectl apply -f jenkins-deployment.yaml
deployment.apps/jenkins created
[root@master1 ~]# kubectl get pods -n jenkins-k8s
NAME READY STATUS RESTARTS AGE
jenkins-74b4c59549-g8rtq 1/1 Running 0 2m7s