GitHub Action - Error while running kubernetes set image command

1/23/2020

I have this script to develop CI/CD pipeline using GitHub action. Pipeline's flow is like GitHub -> Docker Hub -> IBM Cloud Kubernetes. I'm facing this issue for 2-3 days while running kubernetes set image command. Tried many things but no luck. And I'm kind a new at this GitHub Actions and Kubernetes. My script;

on:
  push:
    branches:
      - master
jobs:

  build:

    runs-on: ubuntu-latest

    steps:

    - uses: actions/checkout@v2

    - name: Login to DockerHub
      run:  echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin

    - name: Check docker login status
      if: failure()
      run: echo Docker login process failed. Please check the GitHub secrets and your credentials.

      #    - name: Build the Docker image
      #      run:  docker build -t ${{ secrets.DOCKER_REPO }}:${GITHUB_SHA::8} .

      #    - name: Publish to Docker Hub
      #      run:  docker push ${{ secrets.DOCKER_USERNAME }}/nodedemoapp:${GITHUB_SHA::8}

    - name: Install IBM Cloud CLI
      run:  curl -sL https://ibm.biz/idt-installer | bash

    - name: Login to IBM Cloud
      run:  ibmcloud login -u ${{ secrets.IBMCLOUD_USER }} -p ${{ secrets.IBMCLOUD_PWD }} -r au-syd

    - name: Check IBM Cloud login status
      if: failure()
      run: echo IBM Cloud login process failed. Please check the GitHub secrets and your credentials.

    - name: Select Cloud Cluster
      run:  ibmcloud cs cluster-config <cluster-name>

    - name: Deploy to Cluster / Set Docker Image tag
      uses: steebchen/kubectl@master
      env:
              KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
              DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
      with:
              args: set image --record deployment/demo-nodeapp nodeapp=$DOCKER_REPO:dd317a15

              #    - name: Verify Deployment
              #      uses: steebchen/kubectl@master
              #      env:
              #              KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
              #              DEPLOYMENT_NAME: ${{ secrets.DEPLOYMENT_NAME }}
              #      with:
              #              args: '"rollout status deployment/$DEPLOYMENT_NAME"'

And while executing it this is the error I'm facing;

Deploy to Cluster / Set Docker Image tag1s

Run steebchen/kubectl@master
/usr/bin/docker run --name dfb4c0a53d7da9d4a0da4645e42a044b525_8e2c1f --label 488dfb --workdir /github/workspace --rm -e KUBE_CONFIG_DATA -e DOCKER_REPO -e INPUT_ARGS -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/nodeApp/nodeApp":"/github/workspace" 488dfb:4c0a53d7da9d4a0da4645e42a044b525 set image --record deployment/*** ***=$DOCKER_REPO:dd317a15
error: unable to read certificate-authority /tmp/ca-syd01-launchpad.pem for launchpad/bl7ncphs04difh8d6be0 due to open /tmp/ca-syd01-launchpad.pem: no such file or directory
##[error]Docker run failed with exit code 1

Error in GitHub Action

Thanks in advance.

-- vjgediya
github-actions
ibm-cloud
ibm-cloud-kubernetes
iks
kubernetes

1 Answer

1/23/2020

I think you need to check the ibmcloud cs cluster-config <cluster-name> output to ensure it's getting what you want. Unless you set the IKS_BETA_VERSION=1 env var before running the getting the cluster config, you'll get kubeconfig and cert data downloaded to your local machine at $HOME/.bluemix/plugins/container-service/clusters/. If you use the IKS_BETA_VERSION=1 env var, then you'll get the context/cluster/auth info in the default kubeconfig location of $HOME/.kube/config

-- John Pape
Source: StackOverflow