k8s-deploy icon indicating copy to clipboard operation
k8s-deploy copied to clipboard

Bug: Unable to get config, even after using `k8s-set-context`

Open pilotkid opened this issue 1 year ago • 2 comments

What happened?

Unable to successfully authenticate cluster

KUBE_CONFIG has been validated by using the following command

- uses: actions-hub/kubectl@master
  env:
    KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
  with:
    args: get pods

The workflow file is as follows


name: Deploy test site
on:
  push:
    branches:
      - master
  workflow_dispatch:      
jobs:
  build-and-deploy:
    timeout-minutes: 30
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Validate KUBE_CONFIG
        uses: actions-hub/kubectl@master
        env:
          KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
        with:
          args: get pods

      - name: Login to Container Registry
        uses: docker/login-action@v2
        with:
          registry: ${{ secrets.REGISTRY_IP }}
          username: ${{ secrets.REGISTRY_USERNAME }}
          password: ${{ secrets.REGISTRY_KEY }}

      - name: Build Docker container
        run: docker build --pull --rm -f "dockerfile" -t shooter-api:latest "."

      - name: Push Image To Registry
        run: |
          docker tag shooter-api:latest ${{ secrets.REGISTRY_IP }}/straight-score/shooter-api:${{ github.sha }}
          docker push ${{ secrets:REGISTRY_IP }}/straight-score/shooter-api:${{ github.sha }}
     
      - uses: azure/[email protected]

      - uses: Azure/k8s-set-context@v2
        with:
          kubeconfig: ${{ secrets.KUBE_CONFIG }}

      - uses: Azure/k8s-deploy@v4
        with:
          action: deploy
          strategy: basic
          namespace: 'default'
          manifests: |
              kube/next
          images: '${{ secrets.REGISTRY_IP }}/straight-score/shooter-api:${{ github.sha }}'
          force: true

Version

  • [X] I am using the latest version

Runner

Github Ubuntu-latest

Relevant log output

Run Azure/k8s-deploy@v4
Unexpected error attempting to determine if executable file exists '/usr/local/bin/kubectl/kubectl': Error: ENOTDIR: not a directory, stat '/usr/local/bin/kubectl/kubectl'
Deploying manifests
  /opt/hostedtoolcache/kubectl/1.26.1/x64/kubectl apply -f /tmp/deployment.yaml,/tmp/ingress.yaml,/tmp/service.yaml --force --namespace default
  error: error loading config file "/home/runner/work/_temp/kubeconfig_167635718[23](https://github.com/Straight-Score/shooter-api/actions/runs/4171189337/jobs/7220872590#step:13:24)89": couldn't get version/kind; json parse error: json: cannot unmarshal string into Go value of type struct { APIVersion string "json:\"apiVersion,omitempty\""; Kind string "json:\"kind,omitempty\"" }
  Error: Error: undefined

pilotkid avatar Feb 14 '23 06:02 pilotkid