DEV Community

Discussion on: Azure DevOps Environments for Kubernetes EXPLAINED

Collapse
 
purplepiranha profile image
Paul @ Purple Piranha

Great article. If only I'd found this earlier!

I am struggling with approvals and wondered whether you have them working?

Say I have an environment called 'Development' and within it, a namespace 'myproject-dev'. I've set an approver up for the 'Development' environment.

In my yaml:

- stage: DeployDev
  displayName: 'Deploy: Dev'
  dependsOn: Build
  jobs:
  - deployment: DeployDevJob
    displayName: Deploy to dev job
    pool:
      name: $(poolName)
    environment: Development.myproject-dev
    strategy:
      runOnce:
        deploy:
          steps:
          - task: KubernetesManifest@0
            displayName: Deploy to Kubernetes cluster
            inputs:
              action: deploy
              manifests: $(Pipeline.Workspace)/manifests/deployment.yaml
              containers: mycontainerreg.azurecr.io/myproject/website:$(tag)

When run, it gets to the DeployDev stage and fails.

If I change my yaml to have:

environment: Development

When we get to the DeployDev stage, it waits for approval, but then the KubernetesManifest task fails, as it doesn't have the service connection.

Any thoughts would be really helpful.

Collapse
 
purplepiranha profile image
Paul @ Purple Piranha

I deleted the environments in Azure DevOps and then recreated them, identically to before, and it now works fine. Really strange, as I'd recreated them several times already.

Collapse
 
n3wt0n profile image
Davide 'CoderDave' Benvegnù

Hey. That's an interesting behavior... I didn't experience anything like that.

When you said the pipeline was failing when getting to DeployDev stage, did you have any error message?

I wonder if had something to do with the order you've created the environment/namespaces/approval , maybe there is/was a bug there... I've never experienced it tho