Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I mount multiple partitions of a single GCE disk to a Pod?

I'd like use a single google compute engine disk and mount it to multiple places a Kubernetes Google Container Engine.

I'm wondering if using persistentVolumeClaim would work, but what I did expect to work is being able to mount two partitions of the same disk:

  ...
  volumes:
    - name: database
      gcePersistentDisk:
        pdName: dist-1
        fsType: ext4
        partition: 1
        readOnly: true
    - name: media
      gcePersistentDisk:
        pdName: disk-1
        fsType: ext4
        partition: 2
        readOnly: true

Mounting either of them separately works, but trying to mount both gives an error:

FailedMount     Unable to mount volumes for pod "frontend-ni7uf_foo": Could not attach GCE PD "disk-1". Timeout waiting for mount paths to be created.

Technically I can manually mount both partitions on a single instance.

I'm wondering if it's a bug and if there is another solution for that (outside of having multiple disks)?

like image 218
Wernight Avatar asked Dec 18 '22 19:12

Wernight


1 Answers

Looks like it Google Container Engine requires readOnly on both:

containers:
  - volumeMounts:
      - readOnly: true
volumes:
  - gcePersistentDisk:
      readOnly: true
like image 160
Wernight Avatar answered Dec 31 '22 17:12

Wernight