Azure DevOps部署Helm Chart至AKS时元数据捕获失败警告如何解决?
解决Azure DevOps Helm部署AKS时的“Cannot read property 'kind' of null”警告
你遇到的情况是Azure DevOps的Helm部署任务执行完成(应用已成功部署到AKS),但任务末尾抛出如下警告:
##[warning]Capturing deployment metadata failed with error: TypeError: Cannot read property 'kind' of null
完整部署日志如下:
Starting: Deploy Helm chart to qa3 environment ============================================================================== Task : Package and deploy Helm charts Description : Deploy, configure, update a Kubernetes cluster in Azure Container Service by running helm commands Version : 0.201.0 Author : Microsoft Corporation Help : https://aka.ms/azpipes-helm-tsg ============================================================================== /usr/local/bin/helm upgrade --namespace qa3 --install --values /home/vsts/work/1/s/invitation/values.yaml --set deployment.image.tag=***,deployment.environment=qa3,cluster.name=dev,azure.region=westus2,azure.appInsightsKey=***,deployment.deployedBy='cd',application.publicJwtValidationCertPemBase64=***,application.endpointPath=invitational,application.sendGridTemplateId=***,application.twillioFromPhoneNumber=***,secret.AuthToken=***,secret.AccountSid=***,secret.SendGridApiKey=*** --wait --install --reuse-values q5id-app-invitation /home/vsts/work/1/s/invitation Release "q5id-app-invitation" has been upgraded. Happy Helming! NAME: q5id-app-invitation LAST DEPLOYED: Wed Aug 10 14:53:19 2022 NAMESPACE: qa3 STATUS: deployed REVISION: 3 TEST SUITE: None /usr/local/bin/kubectl cluster-info Kubernetes control plane is running at https://***:443 CoreDNS is running at https://***:443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy Metrics-server is running at https://***:443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. ##[warning]Capturing deployment metadata failed with error: TypeError: Cannot read property 'kind' of null Finishing: Deploy Helm chart to qa3 environment
从日志可见应用已成功部署,该警告不影响应用运行,属于Azure DevOps Helm任务的内部错误。
解决方法
- 直接忽略警告:该警告仅为任务在收集部署元数据时的异常,不会影响AKS上的应用状态,部署流程和应用运行均正常的情况下可无需处理。
- 升级Helm任务版本:你使用的是0.201.0版本的Helm任务,微软在后续版本中修复了该元数据捕获的bug,将任务升级到最新版本即可消除警告。
- 验证Helm Manifest完整性:可选执行
helm get manifest q5id-app-invitation -n qa3命令,检查部署的资源定义是否存在格式异常(比如缺失kind字段的资源),若存在则修正Helm Chart模板。
内容的提问来源于stack exchange,提问作者Samuel
相关产品推荐
相关产品推荐

