【问题标题】:How to create pods with readwrite access in kubernetes with glusterfs volume如何使用 glusterfs 卷在 kubernetes 中创建具有读写访问权限的 pod
【发布时间】:2022-10-02 00:10:01
【问题描述】:

我们已经创建了 glusterfs 端点和服务,并且我们在创建 pod 时直接调用了卷。如果我更新了卷中的文件,它将直接在 pod 中更新 /usr/share/nginx/html 但我已使用以下命令进入 pod

kubectl exec -it glusterfs-demo-pod -- /bin/bash

并尝试在 /usr/share/nginx/html 下创建一个无法访问的文件。请帮助我们。我使用了下面的 yaml 代码

apiVersion: v1
kind: Endpoints
metadata:
  name: glusterfs-cluster
subsets:
- addresses:
  - ip: XXX.XX.XX.XX
  ports:
  - port: 49152
EOF


cat <<EOF | kubectl apply -f -                                                    
apiVersion: v1
kind: Service
metadata:
  name: glusterfs-cluster
spec:
  ports:
  - port: 49152
EOF


apiVersion: v1
kind: Pod
metadata:
  name: glusterfs-demo-pod
spec:
  containers:
  - name: glusterfs
    image: nginx
    volumeMounts:
    - mountPath: \"/usr/share/nginx/html\"
      name: glusterfsvol
  volumes:
  - name: glusterfsvol
    glusterfs:
      endpoints: glusterfs-cluster
      path: myvol1
      readOnly: true

    标签: kubernetes


    【解决方案1】:

    这对我有用:readOnly: false

    【讨论】:

      猜你喜欢
      • 2016-09-30
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 2017-08-05
      • 2013-10-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多