Skip to content

Instantly share code, notes, and snippets.

@geekzter
Last active May 24, 2021 08:46
Show Gist options
  • Save geekzter/2cfae43bbdc73a8f060f5c7038b33dbf to your computer and use it in GitHub Desktop.
Save geekzter/2cfae43bbdc73a8f060f5c7038b33dbf to your computer and use it in GitHub Desktop.
Azure VM scale set app deployment to VNet peered AKS
- task: TerraformCLI@0
displayName: 'Terraform output'
inputs:
command: 'output'
workingDirectory: '$(terraformDirectory)'
environmentServiceName: '$(subscriptionConnection)'
runAzLogin: true
allowTelemetryCollection: true
- task: KubectlInstaller@0
displayName: 'Install kubectl'
inputs:
kubectlVersion: 'latest'
- task: Kubernetes@1
displayName: 'kubectl apply: ASP.NET App'
inputs:
connectionType: 'Azure Resource Manager'
azureSubscriptionEndpoint: '$(subscriptionConnection)'
azureResourceGroup: '$(TF_OUT_RESOURCE_GROUP)'
kubernetesCluster: '$(TF_OUT_AKS_NAME)'
useClusterAdmin: true
command: 'apply'
useConfigurationFile: true
configuration: '$(manifestDirectory)/aspnetapp.yaml'
secretType: 'generic'
- task: Kubernetes@1
displayName: 'kubectl apply: Voting App'
inputs:
connectionType: 'Azure Resource Manager'
azureSubscriptionEndpoint: '$(subscriptionConnection)'
azureResourceGroup: '$(TF_OUT_RESOURCE_GROUP)'
kubernetesCluster: '$(TF_OUT_AKS_NAME)'
useClusterAdmin: true
command: 'apply'
useConfigurationFile: true
configuration: '$(manifestDirectory)/internal-vote.yaml'
secretType: 'generic'
- task: AzureCLI@2
displayName: 'Test applications'
inputs:
azureSubscription: '$(subscriptionConnection)'
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
Invoke-WebRequest -UseBasicParsing -Uri (kubectl get service azure-vote-front -o=jsonpath='{.status.loadBalancer}' | ConvertFrom-Json).ingress.ip
Invoke-WebRequest -UseBasicParsing -Uri $(TF_OUT_APPLICATION_GATEWAY_PUBLIC_IP)
addSpnToEnvironment: true
useGlobalConfig: true
failOnStandardError: true
powerShellIgnoreLASTEXITCODE: false
workingDirectory: '$(scriptDirectory)'
env:
KUBECONFIG: variables['KUBE_CONFIG_PATH']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment