Kubernetes pod not binding volumes to container

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″.

  • mysqldump does not dump everything when running in script
  • Configure CodeSniffer on PhpStorm using Docker
  • Redis sentinel docker image / Dockerfile
  • Can Docker help build executable that work in different platform
  • Docker -v issue
  • Docker volume - need permissions to write to database
  • /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!

  • How to connect to docker container in local machina [duplicate]
  • Getting logs of tomcat containers running in kubernetes pods using fluentd, elsasticsearch and kibana
  • How to access War File Build deployed in Tomcat Docker Container after deleting root
  • Kubernetes - Automatically populating CloudDNS records from service endpoints
  • Docker on Amazon Linux AMI
  • Docker default CPU architecture doesn't match host's
  • One Solution collect form web for “Kubernetes pod not binding volumes to container”

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

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.