You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Kubernetes StatefulSet挂载的已有NFS共享上指定mountOptions?

挂载已有NFS共享的Kubernetes StatefulSet示例

下面是一个精简后的配置,用来创建挂载已有NFS共享的StatefulSet:

apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
  name: hostname
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: container
        image: 4730230466298.dkr.ecr.us-east-1.amazonaws.com/container:latest
        volumeMounts:
        - name: efs
          mountPath: /efs
          readOnly: true
      volumes:
      - name: efs
        nfs:
          path: /
          server: 10.33.1.90
          readOnly: true

关键配置要点:

  • replicas: 1:指定StatefulSet仅运行1个Pod实例
  • volumeMounts:把名为efs的NFS卷挂载到容器内的/efs路径,且设置为只读模式
  • volumes段:定义NFS卷核心信息,包括NFS服务器地址10.33.1.90、共享根路径/,同步开启只读权限

内容的提问来源于stack exchange,提问作者user1522264

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:25:12