0
votes

I try to do the following tutorial but I have a problem.

https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/kubernetes/aks-template?view=azure-devops

https://devblogs.microsoft.com/devops/announcing-kubernetes-integration-for-azure-pipelines/

I want to deploy a simple node app in my kubernetes cluster but the YAML Template "Deploy to Azure Kubernetes Service" doesn't appear. Any idea why this could happen? It worked yesterday but now the option is gone.

Here is the link to my git repo:

https://github.com/StephanPillhofer/SimpleNodeApp

Any help very welcome.

2
The Kubernetes cluster is AKS?Amit Baranes
Yes, exactly. Forgot to mention that. The cluster and a azure container registry are existingStephan Pillhofer
@Stephan Pillhofer Not get your latest information, is the workaround helpful for you? Or if you have any concern, feel free to share it here.Hugh Lin
I am sure the workaround would have worked but I managed to do it as described in the tutorial. ThxStephan Pillhofer

2 Answers

1
votes

Well, as you mentioned in comments the Kubernetes cluster located under Azure (AKS), therefore you can use the following steps which I find easier to maintain and more straight forward :

First of all, Get credentials from AKS using Azure CLI using az aks get-credentials. This command gets access credentials for a managed Kubernetes cluster and allows you to run kubectl commands from the agent:

steps:
- task: AzureCLI@1
  displayName: 'Azure CLI - get credentials from aks'
  inputs:
    azureSubscription: '$(azure_subscription)'
    scriptLocation: inlineScript
    inlineScript: 'az aks get-credentials --resource-group $(resource_group_name) --name $(cluster_name)'

Now, you can run any kubectl command using a bash script.

For instance :

 bash: |
  kubectl apply -f manifest.yml
  displayName: 'Kubectl apply my manifest.yaml'

In my opinion, it's better using bash scripts instead of depending on extensions. And, if you want to migrate your Yaml to another resource such as Jenkins you can do it easily.

Kubectl commands.

0
votes

The problem was that I didn't enable the preview feature multiple staged pipelines in the setting. Thx for your help.