在Azure Devops发布管道中进行Kubectl部署失败,并显示AKS群集的退出代码1 [英] Kubectl deploy in Azure Devops Release Pipeline failed with exit code 1 for AKS Cluster

查看:130
本文介绍了在Azure Devops发布管道中进行Kubectl部署失败,并显示AKS群集的退出代码1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会问是否有人可以帮助我通往AKS集群的发布管道失败.我正在使用Azure Devops发布管道.

I would request if someone can help in why my release pipeline to AKS cluster is failing. I'm using Azure Devops Release pipeline.

2020-09-02T10:56:33.1944594Z ##[section]Starting: kubectl create app and service or apply
2020-09-02T10:56:33.2380678Z ==============================================================================
2020-09-02T10:56:33.2381778Z Task         : Kubectl
2020-09-02T10:56:33.2384698Z Description  : Deploy, configure, update a Kubernetes cluster in Azure Container Service by running kubectl commands
2020-09-02T10:56:33.2385174Z Version      : 1.173.0
2020-09-02T10:56:33.2386143Z Author       : Microsoft Corporation
2020-09-02T10:56:33.2387216Z Help         : https://aka.ms/azpipes-kubectl-tsg
2020-09-02T10:56:33.2387656Z ==============================================================================
2020-09-02T10:56:34.9075560Z Downloading: https://storage.googleapis.com/kubernetes-release/release/v1.7.0/bin/windows/amd64/kubectl.exe
2020-09-02T10:56:37.8112374Z Caching tool: kubectl 1.7.0 x64
2020-09-02T10:56:37.9135761Z Prepending PATH environment variable with directory: C:\hostedtoolcache\windows\kubectl\1.7.0\x64
2020-09-02T10:56:40.4896282Z Could not fetch Kubectl version. Please make sure that the Kubernetes server is up and running.
2020-09-02T10:56:40.5241929Z [command]C:\hostedtoolcache\windows\kubectl\1.7.0\x64\kubectl.exe apply -f D:\a\r1\a\_praneshshzl_AKSCICDDEMO\aksdeploy.yml -o json
2020-09-02T10:56:49.8395443Z {
2020-09-02T10:56:49.8397440Z     "apiVersion": "apps/v1",
2020-09-02T10:56:49.8398489Z     "kind": "Deployment",
2020-09-02T10:56:49.8399348Z     "metadata": {
2020-09-02T10:56:49.8400030Z         "annotations": {
2020-09-02T10:56:49.8401188Z             "deployment.kubernetes.io/revision": "2",
2020-09-02T10:56:49.8404455Z             "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"aspx-deployment\",\"namespace\":\"default\"},\"spec\":{\"replicas\":2,\"selector\":{\"matchLabels\":{\"app\":\"asp-net\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"asp-net\"}},\"spec\":{\"containers\":[{\"image\":\"***/drop:40\",\"name\":\"asp\",\"ports\":[{\"containerPort\":80}]}]}}}}\n"
2020-09-02T10:56:49.8406762Z         },
2020-09-02T10:56:49.8407640Z         "creationTimestamp": "2020-09-02T07:19:54Z",
2020-09-02T10:56:49.8408392Z         "generation": 2,
2020-09-02T10:56:49.8409051Z         "name": "aspx-deployment",
2020-09-02T10:56:49.8409752Z         "namespace": "default",
2020-09-02T10:56:49.8410403Z         "resourceVersion": "19157",
2020-09-02T10:56:49.8411229Z         "selfLink": "/apis/apps/v1/namespaces/default/deployments/aspx-deployment",
2020-09-02T10:56:49.8412093Z         "uid": "57c18e4d-0583-43bc-b0c4-58d6bb2c9069"
2020-09-02T10:56:49.8413323Z     },
2020-09-02T10:56:49.8413859Z     "spec": {
2020-09-02T10:56:49.8414348Z         "progressDeadlineSeconds": 600,
2020-09-02T10:56:49.8414799Z         "replicas": 2,
2020-09-02T10:56:49.8415097Z         "revisionHistoryLimit": 10,
2020-09-02T10:56:49.8415368Z         "selector": {
2020-09-02T10:56:49.8415640Z             "matchLabels": {
2020-09-02T10:56:49.8416109Z                 "app": "asp-net"
2020-09-02T10:56:49.8416360Z             }
2020-09-02T10:56:49.8416549Z         },
2020-09-02T10:56:49.8416778Z         "strategy": {
2020-09-02T10:56:49.8417054Z             "rollingUpdate": {
2020-09-02T10:56:49.8417341Z                 "maxSurge": "25%",
2020-09-02T10:56:49.8417658Z                 "maxUnavailable": "25%"
2020-09-02T10:56:49.8417927Z             },
2020-09-02T10:56:49.8418189Z             "type": "RollingUpdate"
2020-09-02T10:56:49.8418422Z         },
2020-09-02T10:56:49.8418649Z         "template": {
2020-09-02T10:56:49.8419141Z             "metadata": {
2020-09-02T10:56:49.8419452Z                 "creationTimestamp": null,
2020-09-02T10:56:49.8419748Z                 "labels": {
2020-09-02T10:56:49.8420044Z                     "app": "asp-net"
2020-09-02T10:56:49.8420308Z                 }
2020-09-02T10:56:49.8420525Z             },
2020-09-02T10:56:49.8420745Z             "spec": {
2020-09-02T10:56:49.8422686Z                 "containers": [
2020-09-02T10:56:49.8422953Z                     {
2020-09-02T10:56:49.8423661Z                         "image": "***/drop:40",
2020-09-02T10:56:49.8424053Z                         "imagePullPolicy": "IfNotPresent",
2020-09-02T10:56:49.8424416Z                         "name": "asp",
2020-09-02T10:56:49.8424731Z                         "ports": [
2020-09-02T10:56:49.8425016Z                             {
2020-09-02T10:56:49.8425324Z                                 "containerPort": 80,
2020-09-02T10:56:49.8425698Z                                 "protocol": "TCP"
2020-09-02T10:56:49.8426026Z                             }
2020-09-02T10:56:49.8426285Z                         ],
2020-09-02T10:56:49.8426562Z                         "resources": {},
2020-09-02T10:56:49.8426957Z                         "terminationMessagePath": "/dev/termination-log",
2020-09-02T10:56:49.8427380Z                         "terminationMessagePolicy": "File"
2020-09-02T10:56:49.8427696Z                     }
2020-09-02T10:56:49.8427918Z                 ],
2020-09-02T10:56:49.8428205Z                 "dnsPolicy": "ClusterFirst",
2020-09-02T10:56:49.8428542Z                 "restartPolicy": "Always",
2020-09-02T10:56:49.8428896Z                 "schedulerName": "default-scheduler",
2020-09-02T10:56:49.8429231Z                 "securityContext": {},
2020-09-02T10:56:49.8429585Z                 "terminationGracePeriodSeconds": 30
2020-09-02T10:56:49.8429873Z             }
2020-09-02T10:56:49.8430792Z         }
2020-09-02T10:56:49.8431012Z     },
2020-09-02T10:56:49.8431285Z     "status": {
2020-09-02T10:56:49.8431559Z         "availableReplicas": 2,
2020-09-02T10:56:49.8431825Z         "conditions": [
2020-09-02T10:56:49.8432059Z             {
2020-09-02T10:56:49.8432383Z                 "lastTransitionTime": "2020-09-02T07:19:54Z",
2020-09-02T10:56:49.8432798Z                 "lastUpdateTime": "2020-09-02T07:37:15Z",
2020-09-02T10:56:49.8433255Z                 "message": "ReplicaSet \"aspx-deployment-84597d88f5\" has successfully progressed.",
2020-09-02T10:56:49.8434044Z                 "reason": "NewReplicaSetAvailable",
2020-09-02T10:56:49.8434679Z                 "status": "True",
2020-09-02T10:56:49.8435244Z                 "type": "Progressing"
2020-09-02T10:56:49.8435605Z             },
2020-09-02T10:56:49.8435825Z             {
2020-09-02T10:56:49.8436146Z                 "lastTransitionTime": "2020-09-02T10:53:01Z",
2020-09-02T10:56:49.8436562Z                 "lastUpdateTime": "2020-09-02T10:53:01Z",
2020-09-02T10:56:49.8436957Z                 "message": "Deployment has minimum availability.",
2020-09-02T10:56:49.8437364Z                 "reason": "MinimumReplicasAvailable",
2020-09-02T10:56:49.8437756Z                 "status": "True",
2020-09-02T10:56:49.8438064Z                 "type": "Available"
2020-09-02T10:56:49.8438304Z             }
2020-09-02T10:56:49.8438510Z         ],
2020-09-02T10:56:49.8438765Z         "observedGeneration": 2,
2020-09-02T10:56:49.8439067Z         "readyReplicas": 2,
2020-09-02T10:56:49.8439325Z         "replicas": 2,
2020-09-02T10:56:49.8439604Z         "updatedReplicas": 2
2020-09-02T10:56:49.8439834Z     }
2020-09-02T10:56:49.8440256Z }
2020-09-02T10:56:50.0434980Z error: error validating "D:\\a\\r1\\a\\_praneshshzl_AKSCICDDEMO\\aksdeploy.yml": error validating data: the server could not find the requested resource; if you choose to ignore these errors, turn validation off with --validate=false
2020-09-02T10:56:50.0592077Z commandOutput{
2020-09-02T10:56:50.0592764Z     "apiVersion": "apps/v1",
2020-09-02T10:56:50.0593476Z     "kind": "Deployment",
2020-09-02T10:56:50.0593853Z     "metadata": {
2020-09-02T10:56:50.0594453Z         "annotations": {
2020-09-02T10:56:50.0617018Z             "deployment.kubernetes.io/revision": "2",
2020-09-02T10:56:50.0619826Z             "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"aspx-deployment\",\"namespace\":\"default\"},\"spec\":{\"replicas\":2,\"selector\":{\"matchLabels\":{\"app\":\"asp-net\"}},\"template\":{\"metadata\":{\"labels\":{\"app\":\"asp-net\"}},\"spec\":{\"containers\":[{\"image\":\"***/drop:40\",\"name\":\"asp\",\"ports\":[{\"containerPort\":80}]}]}}}}\n"
2020-09-02T10:56:50.0622683Z         },
2020-09-02T10:56:50.0623075Z         "creationTimestamp": "2020-09-02T07:19:54Z",
2020-09-02T10:56:50.0623735Z         "generation": 2,
2020-09-02T10:56:50.0624085Z         "name": "aspx-deployment",
2020-09-02T10:56:50.0624371Z         "namespace": "default",
2020-09-02T10:56:50.0624697Z         "resourceVersion": "19157",
2020-09-02T10:56:50.0628209Z         "selfLink": "/apis/apps/v1/namespaces/default/deployments/aspx-deployment",
2020-09-02T10:56:50.0628683Z         "uid": "57c18e4d-0583-43bc-b0c4-58d6bb2c9069"
2020-09-02T10:56:50.0628948Z     },
2020-09-02T10:56:50.0629156Z     "spec": {
2020-09-02T10:56:50.0629632Z         "progressDeadlineSeconds": 600,
2020-09-02T10:56:50.0629958Z         "replicas": 2,
2020-09-02T10:56:50.0630236Z         "revisionHistoryLimit": 10,
2020-09-02T10:56:50.0633694Z         "selector": {
2020-09-02T10:56:50.0634104Z             "matchLabels": {
2020-09-02T10:56:50.0634389Z                 "app": "asp-net"
2020-09-02T10:56:50.0634654Z             }
2020-09-02T10:56:50.0634863Z         },
2020-09-02T10:56:50.0635116Z         "strategy": {
2020-09-02T10:56:50.0635383Z             "rollingUpdate": {
2020-09-02T10:56:50.0635685Z                 "maxSurge": "25%",
2020-09-02T10:56:50.0636003Z                 "maxUnavailable": "25%"
2020-09-02T10:56:50.0636322Z             },
2020-09-02T10:56:50.0636572Z             "type": "RollingUpdate"
2020-09-02T10:56:50.0636821Z         },
2020-09-02T10:56:50.0637050Z         "template": {
2020-09-02T10:56:50.0637316Z             "metadata": {
2020-09-02T10:56:50.0637611Z                 "creationTimestamp": null,
2020-09-02T10:56:50.0637922Z                 "labels": {
2020-09-02T10:56:50.0638230Z                     "app": "asp-net"
2020-09-02T10:56:50.0638483Z                 }
2020-09-02T10:56:50.0638819Z             },
2020-09-02T10:56:50.0639105Z             "spec": {
2020-09-02T10:56:50.0639388Z                 "containers": [
2020-09-02T10:56:50.0639651Z                     {
2020-09-02T10:56:50.0640045Z                         "image": "***/drop:40",
2020-09-02T10:56:50.0640435Z                         "imagePullPolicy": "IfNotPresent",
2020-09-02T10:56:50.0640782Z                         "name": "asp",
2020-09-02T10:56:50.0641098Z                         "ports": [
2020-09-02T10:56:50.0641395Z                             {
2020-09-02T10:56:50.0642030Z                                 "containerPort": 80,
2020-09-02T10:56:50.0642527Z                                 "protocol": "TCP"
2020-09-02T10:56:50.0642853Z                             }
2020-09-02T10:56:50.0643111Z                         ],
2020-09-02T10:56:50.0643405Z                         "resources": {},
2020-09-02T10:56:50.0643802Z                         "terminationMessagePath": "/dev/termination-log",
2020-09-02T10:56:50.0644232Z                         "terminationMessagePolicy": "File"
2020-09-02T10:56:50.0644550Z                     }
2020-09-02T10:56:50.0644768Z                 ],
2020-09-02T10:56:50.0645058Z                 "dnsPolicy": "ClusterFirst",
2020-09-02T10:56:50.0645398Z                 "restartPolicy": "Always",
2020-09-02T10:56:50.0645752Z                 "schedulerName": "default-scheduler",
2020-09-02T10:56:50.0646087Z                 "securityContext": {},
2020-09-02T10:56:50.0646605Z                 "terminationGracePeriodSeconds": 30
2020-09-02T10:56:50.0646902Z             }
2020-09-02T10:56:50.0647131Z         }
2020-09-02T10:56:50.0647308Z     },
2020-09-02T10:56:50.0647518Z     "status": {
2020-09-02T10:56:50.0647785Z         "availableReplicas": 2,
2020-09-02T10:56:50.0648069Z         "conditions": [
2020-09-02T10:56:50.0648292Z             {
2020-09-02T10:56:50.0648700Z                 "lastTransitionTime": "2020-09-02T07:19:54Z",
2020-09-02T10:56:50.0649116Z                 "lastUpdateTime": "2020-09-02T07:37:15Z",
2020-09-02T10:56:50.0649585Z                 "message": "ReplicaSet \"aspx-deployment-84597d88f5\" has successfully progressed.",
2020-09-02T10:56:50.0650020Z                 "reason": "NewReplicaSetAvailable",
2020-09-02T10:56:50.0650354Z                 "status": "True",
2020-09-02T10:56:50.0650662Z                 "type": "Progressing"
2020-09-02T10:56:50.0650920Z             },
2020-09-02T10:56:50.0651117Z             {
2020-09-02T10:56:50.0651508Z                 "lastTransitionTime": "2020-09-02T10:53:01Z",
2020-09-02T10:56:50.0652363Z                 "lastUpdateTime": "2020-09-02T10:53:01Z",
2020-09-02T10:56:50.0652807Z                 "message": "Deployment has minimum availability.",
2020-09-02T10:56:50.0653184Z                 "reason": "MinimumReplicasAvailable",
2020-09-02T10:56:50.0653520Z                 "status": "True",
2020-09-02T10:56:50.0653840Z                 "type": "Available"
2020-09-02T10:56:50.0654095Z             }
2020-09-02T10:56:50.0654285Z         ],
2020-09-02T10:56:50.0654538Z         "observedGeneration": 2,
2020-09-02T10:56:50.0654831Z         "readyReplicas": 2,
2020-09-02T10:56:50.0655099Z         "replicas": 2,
2020-09-02T10:56:50.0655360Z         "updatedReplicas": 2
2020-09-02T10:56:50.0655592Z     }
2020-09-02T10:56:50.0655767Z }
2020-09-02T10:56:50.0655889Z 
2020-09-02T10:56:52.6885299Z ##[error]The process 'C:\hostedtoolcache\windows\kubectl\1.7.0\x64\kubectl.exe' failed with exit code 1
2020-09-02T10:56:52.7480636Z ##[section]Finishing: kubectl create app and service or apply

我的aksdeploy.yml文件位于 https://github.com/praneshshzl/AKSCICDDEMO/blob/master/aksdeploy.yml

My aksdeploy.yml file is at https://github.com/praneshshzl/AKSCICDDEMO/blob/master/aksdeploy.yml

我要部署的映像是基于Windows的docker hub映像,位于 https://hub.docker.com/repository/docker/praneshhzl/drop

My image to deploy is a docker hub image based on windows at https://hub.docker.com/repository/docker/praneshhzl/drop

推荐答案

在发布管道中的kubectl apply任务中似乎需要这样做.我们必须转到右窗格,向下滚动,展开高级"菜单.并在版本规范中选中检查最新版本" 框.我的管道构建成功完成.我的部署Yaml中没有问题.

Looks like this was something to do in the kubectl apply task in release pipeline. We have to go to right pane, scroll down, expand "advanced" and in version spec check the box "check for latest version". My pipeline built completed successfully. There was no issues in my deployment yaml.

启用此选项可确保下载了正确的kubectl.exe最新版本.进入VSTS代理

Enabling this option ensures proper latest version of kubectl.exe is downloaded onto the VSTS agent

Downloading: https://storage.googleapis.com/kubernetes-release/release/stable.txt
2020-09-02T12:18:39.3539227Z Downloading: https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/windows/amd64/kubectl.exe
2020-09-02T12:18:40.7266540Z Caching tool: kubectl 1.19.0 x64
2020-09-02T12:18:40.8028720Z Prepending PATH environment variable with directory: C:\hostedtoolcache\windows\kubectl\1.19.0\x64
2020-09-02T12:18:43.3630075Z ==============================================================================
2020-09-02T12:18:43.3632157Z            Kubectl Client Version: v1.19.0
2020-09-02T12:18:43.3633193Z            Kubectl Server Version: v1.16.13
2020-09-02T12:18:43.3633757Z ==============================================================================

这篇关于在Azure Devops发布管道中进行Kubectl部署失败,并显示AKS群集的退出代码1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆