#kubernetes #azure-devops #azure-pipelines #azure-aks #azure-pipelines-yaml
Вопрос:
я создал конвейер сборки и выпуска, основанный на yaml, в службах Azure devops.Я использую виртуальную машину linux с собственным хостом в качестве агента для запуска своего конвейера. Когда конвейер запускается, он завершает весь этап, как бы он ни продолжал ждать развертывания на шаге k8s .
Пожалуйста, найдите Yaml для развертывания k8s
- task: Kubernetes@1
displayName: 'Deploy App in Development Environment'
inputs:
connectionType: 'Azure Resource Manager'
azureSubscriptionEndpoint: ''
azureResourceGroup: ''
kubernetesCluster: ''
command: 'apply'
arguments: '-f $(System.DefaultWorkingDirectory)dev.yaml'
```
The pipeline keep waiting at this stage for 60 min and the through below error
[![enter image description here][1]][1]
[![enter image description here][2]][2]
[1]: https://i.stack.imgur.com/V6dLD.png
[2]: https://i.stack.imgur.com/5hdWB.png
```
Deploy App in Development Enviroment
View raw log
Starting: Deploy App in Development Enviroment
==============================================================================
Task : Kubectl
Description : Deploy, configure, update a Kubernetes cluster in Azure Container Service by running kubectl commands
Version : 1.181.0
Author : Microsoft Corporation
Help : https://aka.ms/azpipes-kubectl-tsg
==============================================================================
Prepending PATH environment variable with directory: /usr/local/bin
==============================================================================
Kubectl Client Version: v1.20.4
Kubectl Server Version: Could not find kubectl server version
==============================================================================
/usr/local/bin/kubectl apply -f /home/-agent/_work/1/s/kubernetes/dev.yaml -o json
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code CPDSWFNHR to authenticate.
Unable to connect to the server: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
##[error]To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code CPDSWFNHR to authenticate.
##[error]Unable to connect to the server: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
commandOutput
##[error]The process '/usr/local/bin/kubectl' failed with exit code 1
Finishing: Deploy App in Development Enviroment
```
Ответ №1:
Может быть, попробуйте следующее:
1) вам следует изменить json-файл роли пользователя приложения azure, установить allowPublicClient
значение true
и oauth2AllowIdTokenImplicitFlow
в true
.
"allowPublicClient": true,
"oauth2AllowIdTokenImplicitFlow": true
Вот похожая проблема.
2) вы можете попробовать использовать учетные данные az aks для получения учетных данных в задаче azure cli.
Или вы можете попытаться удалить accessToken
и refreshToken
под ~/.kube/config
.
Комментарии:
1. я пытаюсь реализовать : techcommunity.microsoft.com/t5/fasttrack-for-azure/…