我试图在 pod 之间创建共享卷,但 pod 失败仍然存在CrashLoopBackOff
。我正在 k3s 实例上对此进行测试,并按照指南进行设置。
对其中一个 pod 的描述产生(注意:我删除了私有 repo 的 url):
Last State: Terminated
Reason: Error
Exit Code: 1
Started: Sun, 11 Jul 2021 15:06:00 +0000
Finished: Sun, 11 Jul 2021 15:06:00 +0000
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 27m default-scheduler 0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
Normal Scheduled 26m default-scheduler Successfully assigned default/intelowl-proxy-54b7b8b9f9-55swp to intelowl-k3s
Warning FailedScheduling 27m default-scheduler 0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims.
Normal Pulling 26m kubelet Pulling image "<removed>"
Normal Pulled 25m kubelet Successfully pulled image "<removed>" in 1m20.189996241s
Normal Pulled 23m (x4 over 25m) kubelet Container image "<removed>" already present on machine
Normal Created 23m (x5 over 25m) kubelet Created container intelowl-proxy
Normal Started 23m (x5 over 25m) kubelet Started container intelowl-proxy
Warning BackOff 82s (x111 over 25m) kubelet Back-off restarting failed container
虽然,在检查 pvc 时似乎都被绑定了:
NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
default intelowl-postgres-data Bound pvc-d76a31f6-d299-47ff-865a-697a561bf105 1Gi RWO local-path 29m
default intelowl-django-logs Bound pvc-c33f9315-f488-4e21-9ac3-c20800c1e82f 100Mi RWX longhorn 29m
default intelowl-fileshare Bound pvc-f83ae618-e8b4-4362-8969-ed7d511c4780 100Mi RWX longhorn 29m
default intelowl-static-content Bound pvc-7bdd64a1-32d1-40e8-ba1c-56083dc70254 100Mi RWX longhorn 29m
default intelowl-proxy-logs Bound pvc-2ee18300-5b0e-47a0-9062-78569e62a5a9 100Mi RWO local-path 29m
以防万一,文件共享上的描述:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Provisioning 30m driver.longhorn.io_csi-provisioner-5c9dfb6446-tzdfx_1235bfeb-dc42-4a2d-9a22-2ae80a07865c External provisioner is provisioning volume for claim "default/intelowl-fileshare"
Normal ExternalProvisioning 30m (x3 over 30m) persistentvolume-controller waiting for a volume to be created, either by external provisioner "driver.longhorn.io" or manually created by system administrator
Normal ProvisioningSucceeded 30m driver.longhorn.io_csi-provisioner-5c9dfb6446-tzdfx_1235bfeb-dc42-4a2d-9a22-2ae80a07865c Successfully provisioned volume pvc-f83ae618-e8b4-4362-8969-ed7d511c4780
PVC 定义为(其中之一的示例):
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: intelowl
name: intelowl-fileshare
spec:
storageClassName: longhorn
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: 100Mi
然后添加为
...
containers:
- ...
volumeMounts:
- mountPath: /opt/deploy/files_required
name: intelowl-fileshare
volumes:
- name: intelowl-fileshare
persistentVolumeClaim:
claimName: intelowl-fileshare