我正在尝试在Kubernetes上安装Jenkins,并使用其官方指南:at Jenkins's site,安装Jenkins with Helm v3。环境是Linux/Minikube。
1.创建命名空间Jenkins
1.使用the yaml provided创建持久卷
1.创建service account
1.安装了helm install jenkins -n jenkins -f jenkins-values.yaml jenkinsci/jenkins
,其中值也是官方的,我只提醒Jenkins值,因为它是在说明中推荐的(下面添加了值):
storageClass: jenkins-pv
...
serviceAccount:
create: false
**问题:Jenkins pod从未启动。 它说:“0/1节点可用:% 1节点未找到要绑定的可用持久卷。抢占:0/1个节点可用:1抢占对调度没有帮助..."
PV创建:
rage@ubuntu-virtual:~$ kubectl describe pv jenkins -n jenkins
Name: jenkins-pv
Labels: <none>
Annotations: pv.kubernetes.io/bound-by-controller: yes
Finalizers: [kubernetes.io/pv-protection]
StorageClass: jenkins-pv
Status: Released
Claim: default/jenkins
Reclaim Policy: Retain
Access Modes: RWO
VolumeMode: Filesystem
Capacity: 5Gi
Node Affinity: <none>
Message:
Source:
Type: HostPath (bare host directory volume)
Path: /data/jenkins-volume/
HostPathType:
Events: <none>
PVC说道:“WaitForPodScheduled”
$ kubectl describe pvc jenkins -n jenkins
Name: jenkins
Namespace: jenkins
StorageClass: jenkins-pv
Status: Pending
Volume:
Labels: app.kubernetes.io/component=jenkins-controller
app.kubernetes.io/instance=jenkins
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=jenkins
helm.sh/chart=jenkins-4.3.23
Annotations: meta.helm.sh/release-name: jenkins
meta.helm.sh/release-namespace: jenkins
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode: Filesystem
Used By: jenkins-0
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal WaitForPodScheduled 38m (x481 over 160m) persistentvolume-controller waiting for pod jenkins-0 to be scheduled
Normal WaitForPodScheduled 28m (x26 over 34m) persistentvolume-controller waiting for pod jenkins-0 to be scheduled
Normal WaitForPodScheduled 2m35s (x81 over 22m) persistentvolume-controller waiting for pod jenkins-0 to be scheduled
Pod描述:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 37s default-scheduler 0/1 nodes are available: 1 node(s) didn't find available persistent volumes to bind. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling..
请帮助调查这个问题。我怀疑它与PVC有关,但不能抓住问题到底在哪里。
更新
我还尝试将nodeAffinity添加到我的PersistentVolume中,但没有成功。我把minikube放在这里,因为我在本地开发
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- minikube
我还添加了名为Jenkins的claimRef。Jenkins Helm安装会创建具有此名称的PVC。
claimRef:
name: jenkins
namespace: jenkins
2条答案
按热度按时间8fq7wneg1#
终于解决了这个问题。得到了实际的Jenkins卷声明,它是用Helm-chart部署的:
jenkins -n jenkins -o yaml
它指出:
我的体积较小:5Gi。这就是为什么PVC请求没有得到满足。非常奇怪,当我为PVC/pod执行'describe'命令时,Kubernetes没有任何特别的通知。
因此,我调整了随Jenkins Helm chart提供的values.yaml,以获得较小的大小:
现在它按预期工作。因此,在与此案有关的官方文件中没有任何故障。
p4tfgftt2#
jenkins's site处pv的yaml具有如下所示的nodeSelector
您是否已将worker-node 01替换为您的nodeName?