Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
pilotkid opened this issue Feb 14, 2023 · 2 comments
Open
1 task done

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

pilotkid opened this issue Feb 14, 2023 · 2 comments
Labels
idle Inactive for 14 days waiting-for-customer Waiting for inputs from customer

Comments

@pilotkid
Copy link

pilotkid commented Feb 14, 2023

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/setup-kubectl@v2.0

      - 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

  • 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 pilotkid added the bug Something isn't working label Feb 14, 2023
@OliverMKing
Copy link
Collaborator

@pilotkid can you try again with bumping azure/setup-kubectl and azure/k8s-set-context to v3?

Based on the error message, it looks like your Kubeconfig is unable to be parsed correctly. I wonder if it is in a different format. Could you post the general format of your Kubeconfig (with the important information redacted)?

@github-actions
Copy link

github-actions bot commented Mar 2, 2023

This issue is idle because it has been open for 14 days with no activity.

@github-actions github-actions bot added the idle Inactive for 14 days label Mar 2, 2023
@OliverMKing OliverMKing added waiting-for-customer Waiting for inputs from customer and removed bug Something isn't working labels Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle Inactive for 14 days waiting-for-customer Waiting for inputs from customer
Projects
None yet
Development

No branches or pull requests

2 participants