Is there a way to specify environment variables in a persistent volume claim in kubernetes for the storage size?
e.g. something like that:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jenkins-pvc
namespace: devops
spec:
storageClassName: openebs-local
accessModes:
- ReadWriteOnce
resources:
requests:
storage: ${JENKINS_PV_SIZE}
CodePudding user response:
Since Operating System wasn't mentioned, I'll assume linux/macos.
You can use envsubst
to substitute the variables mentioned in the manifest with the ones set in the Environment and feed the output to kubectl
:
envsubst < pvc.yaml | kubectl apply -f -