Kubernetes pod not binding volumes to container

9/25/2014

I've got the following ReplicationController JSON defined:

{
  "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"} 

}

The container starts correctly when run with "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 is an NFS share, mounted on all of the minions. Each minion has full RW access and I have verified that the share is present.

After creating the pod containers with the Replication Controller, I can see that the volume was never actually bound, and/or incorrectly mounted:

    "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"
                }
            ]
        },

I find it strange that the container believes /mnt/nfs/wordpress_a is mapped to "/var/lib/docker/vfs/dir/8b5dc8477958f5c1b894e68ab9412b41e81a34ef16dac81f0f9d4884352a90b7".

From the kubelet log:

Desired [10.101.4.15]: [{Namespace:etcd Name:c823da9e-4437-11e4-a3b1-0050568421eb Manifest:{Version:v1beta1 ID:c823da9e-4437-11e4-a3b1-0050568421eb UUID:c823da9e-4437-11e4-a3b1-0050568421eb Volumes:[{Name:wordpress Source:}] Containers:[{Name:php Image:internaluser/php53 Command:[] WorkingDir: Ports:[{Name: HostPort:9021 ContainerPort:80 Protocol:TCP HostIP:}] Env:[{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:{Always:0xa99a20 OnFailure: Never:}}}]

Does anyone have experience with this sort of thing? I've been driving myself crazy troubleshooting this. Thanks!

-- voicemail
docker
kubernetes

1 Answer

9/25/2014

Solved. The volumes syntax was incorrect. https://github.com/GoogleCloudPlatform/kubernetes/issues/1446

-- voicemail
Source: StackOverflow