小编alb*_*brr的帖子

Kubernetes NFS 服务器 pod 挂载适用于 pod ip,但不适用于 kubernetes 服务

我在 pod 中创建了一个 nfs 服务器以将其用作卷。使用卷创建另一个 pod 时,卷挂载确实使用 nfs pod 的 ip。由于这个ip不能保证保持不变,我为我的nfs pod添加了一个服务并添加了一个固定的集群ip。使用卷挂载启动容器时,它总是失败并显示以下错误:

无法为 pod“nginx_default(35ecd8ec-a077-11e8-b7bc-0cc47a9aec96)”挂载卷:等待卷挂载或挂载 pod“default”/“nginx”超时超时。卸载卷列表=[nfs-demo]。未附加卷列表=[nfs-demo nginx-test-account-token-2dpgg]

    apiVersion: v1
    kind: Pod
    metadata:
      name: nfs-server
      labels:
        name: nfs-server
    spec:
      containers:
      - name: nfs-server
        image: my-nfs-server:v1
        args: ["/exports"]
        securityContext:
          privileged: true
    ---
    kind: Service
    apiVersion: v1
    metadata:
      name: nfs-service
    spec:
      selector:
        name: nfs-server
      clusterIP: "10.96.0.3"
      ports:
        - name: nfs
          port: 2049
          protocol: UDP
        - name: mountd
          port: 20048
          protocol: UDP   
        - name: rpcbind
          port: 111
          protocol: UDP
        - name: nfs-tcp
          port: 2049
          protocol: …
Run Code Online (Sandbox Code Playgroud)

nfs kubernetes

6
推荐指数
1
解决办法
3499
查看次数

标签 统计

kubernetes ×1

nfs ×1