I am trying to use Oracle Object Storage as a persistent Volume in Oracle Kubernetes Engine.
I have created a Kubernetes cluster and created a public bucket named test-bucket
.
My yaml files are:
storage-class.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: object-storage
provisioner: oci.oraclecloud.com/object-storage
parameters:
compartment-id:
bucket-name: test-bucket
access-key:
secret-key:
pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: object-storage-pvc
spec:
storageClassName: object-storage
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: object-storage-pod
spec:
containers:
- name: object-storage-container
image: busybox
command: ["sleep", "infinity"]
volumeMounts:
- name: object-storage
mountPath: /home/user/data
volumes:
- name: object-storage
persistentVolumeClaim:
claimName: object-storage-pvc
I have applied all of the files but I am receiving this error when I create the PVC.
Normal ExternalProvisioning 3m2s (x26 over 8m53s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "oci.oraclecloud.com/object-storage" or manually created by system administrator
I also tried to create the volume by myself but that also didn't work.
I have tried many different things but I am not sure If I am missing anything here.
Any help would be appreciated.
Thanks
I don't think that would work, as using object storage as a PVC is currently not supported by OCI.
Here's an alternative that would work, but currently involves manual steps:
Install s3fs on each of your nodes. This will allow you to mount s3 bucket (including OCI's S3) as a mount folder. Then you can mount the volume into your container, using host path. If you restart your nodes, you will need to remmount the bucket, or setup a service to startup on reboot. If you have multiple nodes, or constantly delete/add nodes, it could be a pain.