-1

I have created build and release pipeline which is yaml based in azure devops services.
I am using self host linux vm as a agent to run my pipeline.
When the pipeline runs it complete all stage how ever it keep on waiting on deploy to k8s step.

Please find the Yaml for k8s deployment

- 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

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
quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107
Satyam Pandey
  • 593
  • 2
  • 10
  • 32

1 Answers1

-1

Maybe try the following:

1) you should modify your azure app user role json file, set allowPublicClient to true and oauth2AllowIdTokenImplicitFlow to true.

"allowPublicClient": true,
"oauth2AllowIdTokenImplicitFlow": true

Here is a similar issue.

2) you could try to use az aks get-credentials under azure cli task.

Or you could try to delete accessToken and refreshToken under ~/.kube/config.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • i am trying to implement : https://techcommunity.microsoft.com/t5/fasttrack-for-azure/using-azure-devops-to-deploy-an-application-on-aks-private/ba-p/2029630 – Satyam Pandey May 07 '21 at 09:09