Helm 安装失败,出现错误: INSTALLATION FAILED: 无法修补 “cp-kong-init-migrations”。

huangapple go评论103阅读模式
英文:

Helm install fails and gives "Error: INSTALLATION FAILED: cannot patch "cp-kong-init-migrations""

问题

以下是您要翻译的部分:

"我正在尝试通过Gitlab CI/CD管道在Kubernetes集群中使用Helm自动部署Kong。一切都运行正常,直到我运行以下命令“helm install cp charts/kong -n kong -f cp.yaml”。

这是我的cp-kong-init-migrations清单的一部分:

  1. apiVersion: v1
  2. kind: Pod
  3. metadata:
  4. annotations:
  5. kubernetes.io/psp: eks.privileged
  6. sidecar.istio.io/inject: "false"
  7. creationTimestamp: "2023-02-14T20:05:38Z"
  8. generateName: cp-kong-init-migrations-
  9. labels:
  10. app.kubernetes.io/component: init-migrations
  11. app.kubernetes.io/instance: cp
  12. app.kubernetes.io/managed-by: Helm
  13. app.kubernetes.io/name: kong
  14. app.kubernetes.io/version: "3.1"
  15. controller-uid: <uid>
  16. helm.sh/chart: kong-2.15.3
  17. job-name: cp-kong-init-migrations
  18. name: cp-kong-init-migrations-6xfxz
  19. namespace: kong
  20. ownerReferences:
  21. - apiVersion: batch/v1
  22. blockOwnerDeletion: true
  23. controller: true
  24. kind: Job
  25. name: cp-kong-init-migrations
  26. uid: <uid>
  27. resourceVersion: "33448747"
  28. uid: <uid>
  29. spec:
  30. automountServiceAccountToken: true
  31. containers:
  32. - args:
  33. - kong
  34. - migrations
  35. - bootstrap
  36. env:

管道日志显示以下错误(这只是其中一部分):

  1. Error: INSTALLATION FAILED: cannot patch "cp-kong-init-migrations" with kind Job: Job.batch "cp-kong-init-migrations" is invalid: spec.template: Invalid value: core.PodTemplateSpec{ObjectMeta:v1.ObjectMeta{Name:"kong-init-migrations", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil) ....

希望这对您有帮助!

英文:

I am trying to automate the deployment of Kong using Helm in a kubernetes cluster through a Gitlab CI/CD pipeline. Everything works fine until I run this command "helm install cp charts/kong -n kong -f cp.yaml".

This is part of my cp-kong-init-migrations manifest:

  1. apiVersion: v1
  2. kind: Pod
  3. metadata:
  4. annotations:
  5. kubernetes.io/psp: eks.privileged
  6. sidecar.istio.io/inject: &quot;false&quot;
  7. creationTimestamp: &quot;2023-02-14T20:05:38Z&quot;
  8. generateName: cp-kong-init-migrations-
  9. labels:
  10. app.kubernetes.io/component: init-migrations
  11. app.kubernetes.io/instance: cp
  12. app.kubernetes.io/managed-by: Helm
  13. app.kubernetes.io/name: kong
  14. app.kubernetes.io/version: &quot;3.1&quot;
  15. controller-uid: &lt;uid&gt;
  16. helm.sh/chart: kong-2.15.3
  17. job-name: cp-kong-init-migrations
  18. name: cp-kong-init-migrations-6xfxz
  19. namespace: kong
  20. ownerReferences:
  21. - apiVersion: batch/v1
  22. blockOwnerDeletion: true
  23. controller: true
  24. kind: Job
  25. name: cp-kong-init-migrations
  26. uid: &lt;uid&gt;
  27. resourceVersion: &quot;33448747&quot;
  28. uid: &lt;uid&gt;
  29. spec:
  30. automountServiceAccountToken: true
  31. containers:
  32. - args:
  33. - kong
  34. - migrations
  35. - bootstrap
  36. env:

The pipeline logs display this error (this is just a small piece of it):

  1. Error: INSTALLATION FAILED: cannot patch &quot;cp-kong-init-migrations&quot; with kind Job: Job.batch &quot;cp-kong-init-migrations&quot; is invalid: spec.template: Invalid value: core.PodTemplateSpec{ObjectMeta:v1.ObjectMeta{Name:&quot;kong-init-migrations&quot;, GenerateName:&quot;&quot;, Namespace:&quot;&quot;, SelfLink:&quot;&quot;, UID:&quot;&quot;, ResourceVersion:&quot;&quot;, Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil) ....

I have tried looking this error up but there isn't much out there on this so if anyone has any advice that would be extremely helpful!

答案1

得分: 1

问题出在Kubernetes及其工具之间的版本兼容性上。我尝试在Kubernetes集群版本1.22上使用Helm版本3.11,但它们不兼容。您可以通过此图表查看Kubernetes支持的Helm版本 https://helm.sh/docs/topics/version_skew/#:~:text=As%20of%20Helm%203%2C%20Helm%20is%20assumed%20to,to%20be%20compatible%20with%20n-1%20versions%20of%20Kubernetes

我通过降级Helm版本至3.10 来解决了这个问题。

英文:

The issue was version compatability between kubernetes and its tools. I was trying to use helm version 3.11 on a kubernetes cluster version 1.22 and they are not compatible. You can see which helm version are supported by kubernetes with this chart https://helm.sh/docs/topics/version_skew/#:~:text=As%20of%20Helm%203%2C%20Helm%20is%20assumed%20to,to%20be%20compatible%20with%20n-1%20versions%20of%20Kubernetes.

I solved the problem by downgrading helm version to 3.10.

huangapple
  • 本文由 发表于 2023年3月21日 02:52:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75794213.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定