代码之家  ›  专栏  ›  技术社区  ›  Will

Kubernetes(1.10)mountproduction:双向不工作。

  •  2
  • Will  · 技术社区  · 8 年前

    我正在创建一个将volumemount设置为 mountPropagation: Bidirectional 。创建后,容器将用 "Propagation": "rprivate" .

    来自K8 docs 我希望 装载传播:双向 导致卷装入传播 rshared

    如果我直接用 docker 这是有效的。

    一些信息:

    部署yaml

    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: test
    spec:
      selector:
        matchLabels:
          app: test
      strategy:
        type: RollingUpdate
      template:
        metadata:
          labels:
            app: test
        spec:
          containers:
          - image: gcr.io/google_containers/busybox:1.24
            command:
              - sleep
              - "36000"
            name: test
            volumeMounts:
            - mountPath: /tmp/test
              mountPropagation: Bidirectional
              name: test-vol
          volumes:
          - name: test-vol
            hostPath:
              path: /tmp/test
    

    生成的安装部分来自 docker inspect

    "Mounts": [
                {
                    "Type": "bind",
                    "Source": "/tmp/test",
                    "Destination": "/tmp/test",
                    "Mode": "",
                    "RW": true,
                    "Propagation": "rprivate"
                }…..
    

    等效Docker运行

    docker run --restart=always --name test -d --net=host --privileged=true -v /tmp/test:/tmp/test:shared gcr.io/google_containers/busybox:1.24
    

    生成的mounts部分来自 码头工人检查 创建时使用 docker run

    "Mounts": [
                {
                    "Type": "bind",
                    "Source": "/tmp/test",
                    "Destination": "/tmp/test",
                    "Mode": "shared",
                    "RW": true,
                    "Propagation": "shared"
                }...
    

    Kubectl版本的输出

    Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.1", GitCommit:"d4ab47518836c750f9949b9e0d387f20fb92260b", GitTreeState:"clean", BuildDate:"2018-04-13T22:29:03Z", GoVersion:"go1.9.5", Compiler:"gc", Platform:"darwin/amd64"}
    Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.1", GitCommit:"d4ab47518836c750f9949b9e0d387f20fb92260b", GitTreeState:"clean", BuildDate:"2018-04-12T14:14:26Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
    

    使用 rke version v0.1.6

    1 回复  |  直到 8 年前
    推荐文章