I am trying to deploy a microservice in kubernetes with ephemeral storage. So the storage will be deleted at the end of the lifecycle of the pod.
I am getting errors with the below config in deployment.yaml:
deployment.yaml:
volumeMounts:
- name: storage-for-log-export
mountPath: "/scratch"
volumes:
- name: storage-for-log-export
ephemeral:
volumeClaimTemplate:
metadata:
labels:
type: volume-for-log-export
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "scratch-storage-class"
resources:
requests:
storage: 1Gi
Error message : sync failed : Deployment.apps "csm" is invalid: [spec.template.spec.volumes[1]: Required value: must specify a volume type, spec.template.spec.containers[0].volumeMounts[0].name: Not found: "storage-for-log-export"]