Alex D.
Alex D.

Reputation: 63

Cannot mount existing OCI Block Volume into OKE container

I'm trying but failing to mount an existing OCI Block Volume in a container in OKE. The Oracle documentation describes how to do this with FlexVolumes (here). I'm using CSI volumes as these are considered as best practice. The documentation doesn't mention a specific method for CSI volumes.

My efforts constantly result in a new Block Volume being provisioned and mounted, the existing one specified in the Kubernetes PVC definition isn't considered. The actual mount of the new volume works fine.

Kubernetes YAML:

# Overload the OCI storage class, redefining the reclaim policy
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: retain-oci
provisioner: blockvolume.csi.oraclecloud.com
reclaimPolicy: Retain
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgres-volume-claim
  annotations:
    volume.beta.kubernetes.io/oci-volume-source: ocid1.volume.oc1.eu-frankfurt-1.abtheljsl...........
spec:
  storageClassName: "retain-oci"
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50Gi

I've tried using the name of the OCI volume instead of the OCID but this doesn't work either.

Any guidance much appreciated.

Upvotes: 0

Views: 207

Answers (1)

Alex D.
Alex D.

Reputation: 63

Update - I didn't find a solution for the specific problem. However I switched to a OCI Filesystem[0] which was actually a far better fit for my requirements.

[0] https://docs.oracle.com/en-us/iaas/Content/File/Concepts/filestorageoverview.htm

Upvotes: 0

Related Questions