我有一些自动化功能,可以将GitLab中的容器自动部署到K8s。
现在,我正在尝试更高级的内容,并开始使用PersistentVolumeClaim,因此我为此创建了文件(app-pvc.yml),然后在提交代码时出现以下错误:
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
我非常确定文件已正确缩进,并且在我添加PVC文件之前,项目https://gitlab.com/my-k8s-containers/k8s-links正常工作没有任何问题。这是最后一次成功的提交:https://gitlab.com/my-k8s-containers/k8s-links/commit/c86f20b918f02d81b0e211c073af865857f8d4af
实际上,如果我在k8s集群上执行以下操作,则创建pvc不会出现任何问题:
cat <<EOF | kubectl create -f -
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: links-volume-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
EOF
这是整个存储库中唯一包含“资源”一词的文件。
我已经处理了很多这个问题,我想不出解决办法。