我有一个EKS集群,其中有一个守护进程,它将s3存储桶挂载到所有pods。
每当出现问题或pod重新启动时,挂载卷就无法访问,并抛出以下错误。
Transport endpoint is not connected为了解决这个错误,我必须手动卸载卷并重新启动守护进程。
umount /mnt/data-s3-fuse这个问题的永久解决方案是什么?
我的守护进程文件
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
labels:
app: s3-provider
name: s3-provider
namespace: airflow
spec:
template:
metadata:
labels:
app: s3-provider
spec:
containers:
- name: s3fuse
image: image
lifecycle:
preStop:
exec:
command: ["/bin/sh","-c","umount -f /opt/airflow/dags"]
securityContext:
privileged: true
capabilities:
add:
- SYS_ADMIN
# use ALL entries in the config map as environment variables
envFrom:
- configMapRef:
name: s3-config
volumeMounts:
- name: devfuse
mountPath: /dev/fuse
- name: mntdatas3fs
mountPath: /opt/airflow/dags:shared
volumes:
- name: devfuse
hostPath:
path: /dev/fuse
- name: mntdatas3fs
hostPath:
path: /mnt/data-s3-fuse我的pod yaml是
apiVersion: v1
kind: Pod
metadata:
name: test-pd
namespace: airflow
spec:
containers:
- image: nginx
name: s3-test-container
securityContext:
privileged: true
volumeMounts:
- name: mntdatas3fs
mountPath: /opt/airflow/dags:shared
livenessProbe:
exec:
command: ["ls", "/opt/airflow/dags"]
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1
volumes:
- name: mntdatas3fs
hostPath:
path: /mnt/data-s3-fuse我为s3 kubernetes fuse使用了以下代码。
发布于 2021-06-24 19:59:54
对我来说,解决方案是在pod退出之前使用preStop钩子事件卸载路径:
containers:
- name: aws-sync
lifecycle:
preStop:
exec:
command: ['bash', '-c', 'umount -l /mounted/path; true']https://stackoverflow.com/questions/64710309
复制相似问题