Skip to content

Github Action to run kubectl cli by passing kubeconfig.

License

Notifications You must be signed in to change notification settings

teknatha136/actions-kubectl

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubectl-cli action

Usage

TO make use of this action add the following steps to your GitHub Action workflow:

     - uses: teknatha136/actions-kubectl@main
       with:
         kubectl-version: v1.24.3
         kube-config: ${{ secrets.BASE64_ENCODED_KUBECONFIG_SECRET }}

This actions expects an optional kubectl-version input. This is the actual kubectl version that you want to use. You can find more about kubectl versions at https://v1-22.docs.kubernetes.io/docs/tasks/tools/install-kubectl-linux/. By default the actions takes latest stable (https://dl.k8s.io/release/stable.txt) available version.

Action also expects required kube-config input. This is the base64 encoded kubeconfig file. This is usually available at ~/.kube/config.

Once above step is included in you GitHub Action workflow, kubectl will be downloaded and stored ./kubebin directory and kubeconfig file will be decoded and stored at ./.kube/config directory

To execute the kubectl command refer below example

      - uses: teknatha136/actions-kubectl@main
        with:
          kubectl-version: v1.24.3
          kube-config: ${{ secrets.BASE64_ENCODED_KUBECONFIG_SECRET }}

      - run: ./kubebin/kubectl --kubeconfig=.kube/config get nodes

About

Github Action to run kubectl cli by passing kubeconfig.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages