问题描述
我正在尝试向我的镜头盒添加持久性体积声明,以便在重新创建时选择现有的 EBS 体积。 values.yaml中的配置如下。
# If you use Data Policies module enable a Persistent Volume to keep your data policies rule.
persistence:
enabled: true
accessModes:
- ReadWriteOnce
size: 5Gi
# set to true to use you own Persistent volume claim
existingClaim: false
下一步,我将存储声明状态的 Kubectl 补丁添加到 Retain in lens.tf
resource "null_resource" "kubectl" {
provisioner "local-exec" {
command = "kubectl patch pv pvc-f17c30d2-2243-45c7-a91a-ee961a45380c -p '{\"spec\":{\"persistentVolumeReclaimPolicy\":\"Retain\"}}' --kubeconfig <(echo $KUBECONfig | base64 --decode)"
interpreter = ["/bin/bash","-c"]
environment = {
KUBECONfig = base64encode(local.kubeconfig)
}
}
depends_on = [
helm_release.lenses
]
}
EBS 没有被删除,并且在重新创建镜头吊舱后可用。 现在我已将现有声明更改为 ture 并运行构建
# set to true to use you own Persistent volume claim
existingClaim: true
jenkins 出错
Error: Deployment in version "v1" cannot be handled as a Deployment: v1.Deployment.Spec: v1.DeploymentSpec.Template: v1.PodTemplateSpec.Spec: v1.PodSpec.Volumes: []v1.Volume: v1.Volume.VolumeSource: PersistentVolumeClaim: v1.PersistentVolumeClaimVolumeSource.ClaimName: ReadString: expects " or n,but found t,error found in #10 byte of ...|aimName":true}}]}}}}|...,bigger context ...|":"storage","persistentVolumeClaim":{"claimName":true}}]}}}}
|...
on lenses.tf line 1,in resource "helm_release" "lenses":
1: resource "helm_release" "lenses" {
我们正在调用 helm charts 中的所有内容,因此下载了 helm charts index.yaml 并查看了 deployment.yaml
name: storage
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (printf "%s-claim" (include "fullname" .)) }}
{{- end }}
serviceAccountName: {{ .Values.serviceAccount }}
因此,我设置了声明名称而不是 true
existingClaim: lenses-npd-claim
这是我们的 pvc 声明名称
PS C:\Users\pchilu> kubectl get pv pvc-f17c30d2-2243-45c7-a91a-ee961a45380c
NAME CAPACITY ACCESS MODES RECLaim POLICY STATUS CLaim STORAGECLASS REASON AGE
pvc-f17c30d2-2243-45c7-a91a-ee961a45380c 5Gi RWO Retain Released kp-npd/lenses-npd-claim gp2 5d22h
kp-npd 是命名空间,lens-npd-claim 是声明名称 但是当我运行构建时,Pod 正在尝试创建,并且在 5 分钟后超时并且无法创建。
关于我哪里做错的任何建议,或者需要添加什么来修复它。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)