|
| 1 | +name: deploy ingress nginx controller to aks cluster |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + aks_resource_group_name: |
| 6 | + type: string |
| 7 | + description: The name of the resource group where the AKS cluster is located |
| 8 | + default: "DEVWITHKRISHNA-AKS-RG" |
| 9 | + required: true |
| 10 | + aks_cluster_name: |
| 11 | + type: string |
| 12 | + description: The name of the AKS cluster |
| 13 | + default: "DEVWITHKRISHNA-NONPROD" |
| 14 | + required: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + deploy-ingress-nginx-controller: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Checkout source code |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: azure login |
| 25 | + id: azure-login |
| 26 | + uses: azure/login@v1 |
| 27 | + with: |
| 28 | + creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}' |
| 29 | + |
| 30 | + - name: Setup kubectl |
| 31 | + id: install-kubectl |
| 32 | + uses: azure/setup-kubectl@v3 |
| 33 | + with: |
| 34 | + version: "1.28.3" |
| 35 | + |
| 36 | + - name: Setup helm |
| 37 | + id: install-helm |
| 38 | + uses: azure/[email protected] # default is latest (stable) |
| 39 | + |
| 40 | + - name: Set AKS context |
| 41 | + id: set-context |
| 42 | + uses: azure/aks-set-context@v3 |
| 43 | + with: |
| 44 | + resource-group: '${{ inputs.aks_resource_group_name }}' |
| 45 | + cluster-name: '${{ inputs.aks_cluster_name }}' |
| 46 | + |
| 47 | + - name: Deploy to AKS |
| 48 | + id: deploy-ingress |
| 49 | + run: | |
| 50 | + echo "Current Cluster Name is: $(kubectl config current-context)" |
| 51 | +
|
| 52 | + echo "Installing ingress nginx controller using helm..." |
| 53 | +
|
| 54 | + helm upgrade --install ingress-nginx ingress-nginx \ |
| 55 | + --repo https://kubernetes.github.io/ingress-nginx \ |
| 56 | + --namespace ingress-nginx --create-namespace |
| 57 | +
|
| 58 | + sleep 10 |
| 59 | +
|
| 60 | + echo "Checking ingress pods status" |
| 61 | +
|
| 62 | + kubectl wait --namespace ingress-nginx \ |
| 63 | + --for=condition=ready pod \ |
| 64 | + --selector=app.kubernetes.io/component=controller \ |
| 65 | + --timeout=120s |
0 commit comments