GithubHelp home page GithubHelp logo

isabella232 / kubectl-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from siteimprove/kubectl

0.0 0.0 0.0 12 KB

GitHub Action for interacting with kubectl (k8s)

Home Page: https://github.com/marketplace/actions/kuberentes-k8s-cli-kubectl

License: MIT License

Dockerfile 25.95% Shell 74.05%

kubectl-2's Introduction

kubectl

Preview

GitHub Action for interacting with kubectl (k8s)

Usage

To use kubectl put this step into your workflow:

Authorization with config file

- uses: actions-hub/kubectl@master
  env:
    KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
  with:
    args: get pods

Authorization with credentials

- uses: actions-hub/kubectl@master
  env:
    KUBE_HOST: ${{ secrets.KUBE_HOST }}
    KUBE_CERTIFICATE: ${{ secrets.KUBE_CERTIFICATE }}
    KUBE_USERNAME: ${{ secrets.KUBE_USERNAME }}
    KUBE_PASSWORD: ${{ secrets.KUBE_PASSWORD }}
  with:
    args: get pods

Authorization with a bearer token

- uses: actions-hub/kubectl@master
  env:
    KUBE_HOST: ${{ secrets.KUBE_HOST }}
    KUBE_CERTIFICATE: ${{ secrets.KUBE_CERTIFICATE }}
    KUBE_TOKEN: ${{ secrets.KUBE_TOKEN }}
  with:
    args: get pods

Environment variables

All these variables need to authorize to kubernetes cluster.
I recommend using secrets for this.

KUBECONFIG file

First options its to use kubeconfig file.

For this method KUBE_CONFIG required.
You can find it: cat $HOME/.kube/config | base64 .

Optionally you can switch the context (the cluster) if you have few in kubeconfig file. Passing specific context to KUBE_CONTEXT. To see the list of available contexts do: kubectl config get-contexts.

Variable Type
KUBE_CONFIG string (base64)
KUBE_CONTEXT string

KUBECONFIG file

Another way to authenticate in the cluster is HTTP basic auth.

For this you need to pass:

  • host (IP only, without protocol)
  • username
  • password
  • cluster CA certificate
Variable Type
KUBE_HOST string
KUBE_USERNAME string
KUBE_PASSWORD string
KUBE_CERTIFICATE string

Example

name: Get pods
on: [push]

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - uses: actions-hub/kubectl@master
        env:
          KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
        with:
          args: get pods
name: Get pods
on: [push]

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - uses: actions-hub/kubectl@master
        env:
          KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}

      - uses: actions-hub/kubectl@master
        with:
          args: get pods

Versions

If you need a specific version of kubectl, make a PR with a specific version number. After accepting PR the new release will be created.
To use a specific version of kubectl use:

- uses: actions-hub/[email protected]
  env:
    KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
  with:
    args: get pods

Licence

MIT License

kubectl-2's People

Contributors

exelban avatar silverlyra avatar arslnmsd avatar bnahin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.