Kubernetes and GitHub Action Workflow

Sebastian Pacheco 286 Reputation points
2023-04-03T20:18:22.07+00:00

Hello everyone, I have the following query... I have a workflow in GitHub Action where I perform an upload to the Azure Container Registry and then a deployment to the Kubernetes cluster, but in the deployment step the workflow is waiting for an intervention manual: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code FIWCPT2UA to authenticate. deployment.apps/xxxxxxxxx configured

To make it automatic, what should I do? Kubernetes: 1.24.6 Workflow:

......
Deploy_Nurseviewtest:
    permissions:
      actions: read
      contents: read
      id-token: write
    runs-on: ubuntu-latest
    needs: [Build_and_Push_Image, CreateSecret]
    steps:
    - uses: actions/checkout@master

    # Set the target AKS clusterr
    - name: Azure login
      id: login
      uses: azure/login@v1.4.6
      with:
        creds: ${{ secrets.AZURE_CREDENTIALS }}
    - name: Set AKS context
      id: set-context
      uses: azure/aks-set-context@v3
      with:
        resource-group: '${{ env.RESOURCE_GROUP_AKS }}' 
        cluster-name: '${{ env.CLUSTER_NAME }}'

    - name: Setup kubectl
      id: install-kubectl
      uses: azure/setup-kubectl@v3

    - uses: azure/use-kubelogin@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        kubelogin-version: 'latest'

    - name: Deploys application
      id: deploy-aks
      uses: Azure/k8s-deploy@v4
      with:
        action: deploy
        strategy: basic
        namespace: ${{ env.NAMESPACE }}
        manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }}
        images: |
          ${{ secrets.ACR_SERVER }}/${{ env.CONTAINER_NAME }}:${{ github.sha }}
        pull-images: false 

In the next section, I don't really have that secret on github, I'm not 100% sure what it's for or if something should be added:

    - uses: azure/use-kubelogin@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        kubelogin-version: 'latest'

I think I should configure kubernetes non-interactive so that it doesn't ask for web code, but I'm not really sure how to do it without this being a security risk.

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,448 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.