kubernetes Helm安装失败,并给出“错误:安装失败:无法修补“cp-kong-init-migrations”

qyzbxkaa  于 2023-03-29  发布在  Kubernetes
关注(0)|答案(1)|浏览(197)

我正在尝试通过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) ....

我试着查找这个错误,但没有太多的关于这一点,所以如果有人有任何建议,这将是非常有帮助的!

7ivaypg9

7ivaypg91#

问题是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解决了这个问题。

相关问题