Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
terminal

GitHub Action

Kubernetes CLI (kubectl)

v1.2.0

Kubernetes CLI (kubectl)

terminal

Kubernetes CLI (kubectl)

GitHub Action to manage a K8s cluster using kubectl

Installation

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

              

- name: Kubernetes CLI (kubectl)

uses: tale/[email protected]

Learn more about this action in tale/kubectl-action

Choose a version

kubectl-action

GitHub Action to manage a K8s (Kubernetes) cluster using kubectl.

Usage

To use this action, add the following step to your GitHub Action workflow:

- uses: tale/kubectl-action@v1
  with:
    base64-kube-config: ${{ secrets.KUBE_CONFIG }}

Keep in mind that the action expects a base64 encoded string of your Kubernetes configuration. The simplest way to do that is to run cat $HOME/.kube/config | base64 and save that output as an action secret.

It's also possible to specify the version of the kubectl CLI to use. The current default release used by this action is the latest version.

- uses: tale/kubectl-action@v1
  with:
    base64-kube-config: ${{ secrets.KUBE_CONFIG }}
    kubectl-version: v1.22.0

Once you've completed this setup, you have direct access to the kubectl binary and command in the rest of your actions. Here's a full example to give you some inspiration:

name: Kubectl Action

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: tale/kubectl-action@v1
      with:
        base64-kube-config: ${{ secrets.KUBE_CONFIG }}
    - run: kubectl get pods