Skip to content
play

GitHub Action

kubectl-for-eks

v1.0.1 Latest version

kubectl-for-eks

play

kubectl-for-eks

This action provides kubectl for Github Actions. This action includes aws-iam-authenticator for accessing Amazon EKS

Installation

Copy and paste the following snippet into your .yml file.

              

- name: kubectl-for-eks

uses: rsooo/[email protected]

Learn more about this action in rsooo/kubectl

Choose a version

Github Action for Kubernetes CLI

  • This action provides kubectl for Github Actions.
  • folked for installing aws-iam-authenticator
  • This docker image can use aws-iam-authenticator

Usage

.github/workflows/push.yml

on: push
name: deploy
jobs:
  deploy:
    name: deploy to cluster
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: deploy to cluster
      uses: rsooo/kubectl@v1.0.1
      env:
        KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
      with:
        args: set image --record deployment/my-app container=${{ github.repository
          }}:${{ github.sha }}
    - name: verify deployment
      uses: steebchen/kubectl@master
      env:
        KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
      with:
        args: '"rollout status deployment/my-app"'

Secrets

KUBE_CONFIG_DATArequired: A base64-encoded kubeconfig file with credentials for Kubernetes to access the cluster. You can get it by running the following command:

cat $HOME/.kube/config | base64

Note: Do not use kubectl config view as this will hide the certificate-authority-data.