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

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

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清单的一部分:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubernetes.io/psp: eks.privileged
    sidecar.istio.io/inject: "false"
  creationTimestamp: "2023-02-14T20:05:38Z"
  generateName: cp-kong-init-migrations-
  labels:
    app.kubernetes.io/component: init-migrations
    app.kubernetes.io/instance: cp
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: kong
    app.kubernetes.io/version: "3.1"
    controller-uid: <uid>
    helm.sh/chart: kong-2.15.3
    job-name: cp-kong-init-migrations
  name: cp-kong-init-migrations-6xfxz
  namespace: kong
  ownerReferences:
  - apiVersion: batch/v1
    blockOwnerDeletion: true
    controller: true
    kind: Job
    name: cp-kong-init-migrations
    uid: <uid>
  resourceVersion: "33448747"
  uid: <uid>
spec:
  automountServiceAccountToken: true
  containers:
  - args:
    - kong
    - migrations
    - bootstrap
    env:  

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

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:

 apiVersion: v1
  kind: Pod                                                                                                                                                 
  metadata:                                                                                                                                                 
    annotations:                                                                                                                                            
      kubernetes.io/psp: eks.privileged                                                                                                                     
      sidecar.istio.io/inject: &quot;false&quot;                                                                                                                      
    creationTimestamp: &quot;2023-02-14T20:05:38Z&quot;                                                                                                               
    generateName: cp-kong-init-migrations-                                                                                                                  
    labels:                                                                                                                                                 
      app.kubernetes.io/component: init-migrations                                                                                                          
      app.kubernetes.io/instance: cp                                                                                                                        
      app.kubernetes.io/managed-by: Helm                                                                                                                   
      app.kubernetes.io/name: kong                                                                                                                          
      app.kubernetes.io/version: &quot;3.1&quot;                                                                                                                      
      controller-uid: &lt;uid&gt;                                                                                                   
      helm.sh/chart: kong-2.15.3                                                                                                                            
      job-name: cp-kong-init-migrations                                                                                                                     
    name: cp-kong-init-migrations-6xfxz                                                                                                                     
    namespace: kong                                                                                                                                         
    ownerReferences:                                                                                                                                        
    - apiVersion: batch/v1                                                                                                                                  
      blockOwnerDeletion: true                                                                                                                             
      controller: true                                                                                                                                      
      kind: Job                                                                                                                                             
      name: cp-kong-init-migrations                                                                                                                         
      uid: &lt;uid&gt;                                                                                                             
    resourceVersion: &quot;33448747&quot;                                                                                                                             
    uid: &lt;uid&gt;                                                                                                               
  spec:                                                                                                                                                     
    automountServiceAccountToken: true                                                                                                                      
    containers:                                                                                                                                             
    - args:                                                                                                                                                 
      - kong                                                                                                                                                
      - migrations                                                                                                                                          
      - bootstrap                                                                                                                                           
      env:  

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

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:

确定