I've some automation where I can deploy my containers in GitLab automatically to K8s.
Right now I'm trying more advanced stuff and starting to use PersistentVolumeClaim so I created the file for that (app-pvc.yml), then when I commit the code I got the following error:
Tiller (the Helm server-side component) has been upgraded to the current version.
$ helm upgrade --install --set app.name="${NAME}-${CI_COMMIT_REF_SLUG}" --set app.image="${IMAGE}" --set app.host="${URL_PRODUCTION}" --wait --force --debug ${NAME}-${CI_COMMIT_REF_SLUG} ./k8s-chart
[debug] Created tunnel using local port: '43379'
[debug] SERVER: "127.0.0.1:43379"
UPGRADE FAILED
Error: Upgrade --force successfully deleted the previous release, but encountered 1 error(s) and cannot continue: error validating "": error validating data: ValidationError(PersistentVolume.spec): unknown field "resources" in io.k8s.api.core.v1.PersistentVolumeSpec
Error: UPGRADE FAILED: Upgrade --force successfully deleted the previous release, but encountered 1 error(s) and cannot continue: error validating "": error validating data: ValidationError(PersistentVolume.spec): unknown field "resources" in io.k8s.api.core.v1.PersistentVolumeSpec
ERROR: Job failed: exit code 1
I'm very sure the file is properly indented and the project https://gitlab.com/my-k8s-containers/k8s-links worked without any issue previous I added the PVC file. This one was the last successful commit: https://gitlab.com/my-k8s-containers/k8s-links/commit/c86f20b918f02d81b0e211c073af865857f8d4af
Actually if I execute the following over the k8s cluster, the pvc is created without any issue:
cat <<EOF | kubectl create -f -
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: links-volume-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
EOF
And the entire repository this is the only file who contains the word resources.
I've dealing with this issue a lot and I can't figure out the solution.