Standalone kubelet persistent disk mount on Google Cloud instance

I have a process that needs to run daily in a Docker container, syncing some data from a storage bucket to an external volume (Google Cloud persistent disk). So far, I managed to launch the process by creating a single-node container cluster.

Since the process completes in a couple of hours, I want to delete VM resources (except the persistent disk of course) once complete. Launching/deleting a single compute-VM (without the kubernetes cluster setup) seems simpler, so I was trying to get a single kubelet running on a container-optimized cloud instance. Persistent disk mounting is where this fails.

  • “kubectl exec” results in “error: unable to upgrade connection: Unauthorized”
  • Why isn't nginx handling requests in this docker-compose/django setup?
  • Enterprise Apps with Docker and Elastic Beanstalk
  • How to install the kubernetes dns addon manually (skydns, kube2sky trouble)
  • How to configure list of containers / apps for Docker to run?
  • docker-machine ls shows state timeout
  • My launch command:

    gcloud compute instances create cvm-name-0 \
        --image-family=cos-stable \
        --image-project=cos-cloud \
        --boot-disk-type pd-ssd \
        --boot-disk-size 10GB \
        --metadata-from-file \
        "google-container-manifest=containers.yaml,user-data=cloudinit.yaml" \
        --zone "$gzone" \
        --scopes default,storage-rw \
        --machine-type n1-highcpu-4

    Contents of container.yaml:

    apiVersion: v1
    kind: Pod
      name: container-name
        - name: container-name
          imagePullPolicy: Always
            - name: persistent-disk-name
              mountPath: /home/someuser/somedir
        - name: persistent-disk-name
            pdName: persistent-disk-name
            fsType: ext4

    Contents of cloudinit.yaml:

    - echo "KUBELET_OPTS=\"--cloud-provider=gce\"" > /etc/default/kubelet
    - systemctl start kubelet.service

    While the --cloud-provider=gce option fixes the “Failed to get GCE Cloud Provider” error per this question, there is still some problem mounting the disk.

    A potentially relevant line from the container OS log says:

    EXT4-fs (dm-0): couldn’t mount as ext3 due to feature incompatibilities

    Any way to make this work on a single compute instance (without the kubernetes cluster)? Where else should I be looking for more informative error logs?

  • Kubernetes - container communication within a pod using names instead of 'localhost'?
  • Setting up a docker / fig Mesos environment
  • neo4j-mazerunner, How to Increase memory size in docker-compose.yml
  • How to make containers communicate with each other in ECS without link and port mapping?
  • Building and running a docker image for a Go executable
  • Change Java “SecureRandom” in Dockerfile
  • One Solution collect form web for “Standalone kubelet persistent disk mount on Google Cloud instance”

    I’m not using kubernetes at the moment, but I am backing up to a cloud storage bucket.

    I have something like this in my cloud-config:

    - name: dockerrunner
      uid: 2000
      groups: docker
    - path: /home/dockerrunner/
      permissions: 0755
      owner: dockerrunner
      content: |
        export HOME=/home/dockerrunner
        export USER=root
        toolbox --bind /mnt/disks/nfs:/mnt/disks/nfs \
          /google-cloud-sdk/bin/gsutil -m \
          rsync -r /mnt/disks/nfs gs://<bucket-name>/hourly
    - path: /etc/systemd/system/files-backup-hourly.service
      permissions: 0644
      owner: root
      content: |
        Description=Shared Files Backup upload script - hourly
        ExecStart=/bin/sh /home/dockerrunner/
    - path: /etc/systemd/system/files-backup-hourly.timer
      permissions: 0644
      owner: root
      content: |
        Description=Run Shared Files Backup create script every hour
        OnCalendar=*-*-* *:00:00
    - systemctl daemon-reload
    - systemctl start files-backup-hourly.service
    - systemctl start files-backup-hourly.timer
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.