1、k8s1.28.2、helm3.12.0,集群搭建
查看节点运行情况
kubectl get node -o wide
openebs部署情况
kubectl get sc -n openebs
2、添加Jenkins Helm仓库
helm repo add jenkins https://charts.jenkins.io
helm repo update
# 查看版本
helm search repo -l jenkins/jenkins
3、创建命名空间
kubectl create namespace jenkins
看看有哪些 可用的StorageClass
kubectl get storageclass
#执行后
[root@zk1 war]# kubectl get storageclass
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
local-path (default) rancher.io/local-path Delete WaitForFirstConsumer false 59s
openebs-device openebs.io/local Delete WaitForFirstConsumer false 5m22s
openebs-hostpath openebs.io/local Delete WaitForFirstConsumer false 5m22s
4、配置jenkins-values.yaml:(顺带JDK17、调度到zk2节点,用openebs-hostpath存储)
controller:
numExecutors: 2
image:
registry: docker.io
repository: jenkins/jenkins
tag: lts-jdk17
serviceType: NodePort
nodePort: 30080
persistence:
enabled: true
storageClass: openebs-hostpath
size: 8Gi
nodeSelector:
kubernetes.io/hostname: zk2
additionalVolumes:
- name: host-maven
hostPath:
path: /opt/maven
type: Directory
additionalVolumeMounts:
- name: host-maven
mountPath: /opt/maven
sidecars:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:latest
imagePullPolicy: IfNotPresent
command: ["/busybox/cat"]
tty: true
volumeMounts:
- name: kaniko-secret
mountPa