2

我定义了以下 ReplicationController JSON:

{
  "id": "PHPController",
  "kind": "ReplicationController",
  "apiVersion": "v1beta1",
  "desiredState": {
    "replicas": 2,
    "replicaSelector": {"name": "php"},
    "podTemplate": {
      "desiredState": {
         "manifest": {
           "version": "v1beta1",
           "id": "PHPController",
           "volumes": [{ "name": "wordpress", "path": "/mnt/nfs/wordpress_a", "hostDir": "/mnt/nfs/wordpress_a"}],
           "containers": [{
             "name": "php",
             "image": "internaluser/php53",
             "ports": [{"containerPort": 80, "hostPort": 9021}],
             "volumeMounts": [{"name": "wordpress", "mountPath": "/mnt/nfs/wordpress_a"}]
           }]
         }
       },
       "labels": {"name": "php"}
      }},
  "labels": {"name": "php"} 

}

使用“docker run -t -i -p 0.0.0.0:9021:80 -v /mnt/nfs/wordpress_a:/mnt/nfs/wordpress_a:rw internaluser/php53”运行时,容器会正确启动。

/mnt/nfs/wordpress_a 是一个 NFS 共享,安装在所有的 minions 上。每个 minion 都具有完整的 RW 访问权限,并且我已验证该共享存在。

在使用 Replication Controller 创建 pod 容器后,我可以看到该卷从未真正绑定过,和/或未正确安装:

    "Volumes": {
        "/mnt/nfs/wordpress_a": "/var/lib/docker/vfs/dir/8b5dc8477958f5c1b894e68ab9412b41e81a34ef16dac81f0f9d4884352a90b7"
    },
    "VolumesRW": {
        "/mnt/nfs/wordpress_a": true
    }

    "HostConfig": {
        "Binds": null,
        "ContainerIDFile": "",
        "LxcConf": null,
        "Privileged": false,
        "PortBindings": {
            "80/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "9021"
                }
            ]
        },

我觉得奇怪的是容器认为 /mnt/nfs/wordpress_a 映射到“/var/lib/docker/vfs/dir/8b5dc8477958f5c1b894e68ab9412b41e81a34ef16dac81f0f9d4884352a90b7”。

从 kubelet 日志中:

所需[10.101.4.15]:[{命名空间:etcd名称:c823da9e-4437-11e4-a3b1-0050568421eb清单:{版本:v1beta1 ID:c823da9e-4437-11e4-a3b1-0050568421eb UUID:c82349e-4437-ab31 0050568421eb 卷:[{名称:wordpress 源:}] 容器:[{名称:php 图像:internaluser/php53 命令:[] WorkingDir:端口:[{名称:HostPort:9021 ContainerPort:80 协议:TCP HostIP:}] 环境:[{Name:SERVICE_HOST Value:10.1.1.1}] Memory:0 CPU:0 VolumeMounts:[{Name:wordpress ReadOnly:false MountPath:/mnt/nfs/wordpress_a}] LivenessProbe: Lifecycle: Privileged:false}] RestartPolicy: {总是:0xa99a20 OnFailure:从不:}}}]

有没有人有这种事情的经验?我一直在让自己疯狂地解决这个问题。谢谢!

4

1 回答 1

2

解决了。卷语法不正确。 https://github.com/GoogleCloudPlatform/kubernetes/issues/1446

于 2014-09-25T18:15:12.663 回答