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.

  • docker login - error storing credentials - write permissions error
  • Modifying a docker image
  • Why containers network throughput is low
  • Docker swarm mode couldnt connect to another container
  • Some RUNs won't work on docker but will when inside a container
  • Can I run Docker directly on a non VT-X machine (no Virtual Machine used)? [closed]
  • 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?

  • “Could not delete ./” when I use composer in docker
  • Mounting nfs shares inside docker container
  • “Create React App” with Docker
  • Cannot mount volume in docker
  • Change Graph.db location on Neo4j Docker to local file
  • Docker + SSL + apache2 + x509
  • 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.