Giter Site home page Giter Site logo

eks-kubectl-action's Introduction

eks-kubectl

Access your EKS cluster via kubectl in a Github Action. No fuss, no messing around with special kubeconfigs, just ensure you have eks:ListCluster and eks:DescribeCluster rights on your user.

See this great blog post for an overview if you're using a new IAM user.

Example configuration

Supplying AWS credentials

You can supply your AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, the region your cluster is in, and the cluster name.

jobs:
  jobName:
    name: Update deploy
    runs-on: ubuntu-latest 
    steps:
      # --- #
      - name: Build and push CONTAINER_NAME
        uses: ianbelcher/eks-kubectl-action@master
        with:
          aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: ${{ secrets.AWS_REGION }}
          cluster_name: ${{ secrets.CLUSTER_NAME }}
          eks_role_arn: ${{ secrets.EKS_ROLE_ARN }}
          args: set image --record deployment/pod-name pod-name=${{ steps.build.outputs.IMAGE_URL }}
      # --- #

Using the AWS credentials present on the environment

If credentials are already present on the environment you don't need to supply them.

jobs:
  jobName:
    name: Update deploy
    runs-on: ubuntu-latest 
    env:
      aws_region: eu-central-1
    steps:
      - name: AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.MY_AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.MY_AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ env.aws_region }}
      # --- #
      - name: Build and push CONTAINER_NAME
        uses: ianbelcher/eks-kubectl-action@master
        with:
          cluster_name: ${{ secrets.CLUSTER_NAME }}
          args: set image --record deployment/pod-name pod-name=${{ steps.build.outputs.IMAGE_URL }}
      # --- #

Outputs

The action exports the following outputs:

  • kubectl-out: The output of kubectl.
jobs:
  jobName:
    name: Update deploy
    runs-on: ubuntu-latest 
    steps:
      # --- #
      - name: Build and push CONTAINER_NAME
        id: kubectl
        uses: ianbelcher/eks-kubectl-action@master
        with:
          aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: ${{ secrets.AWS_REGION }}
          cluster_name: ${{ secrets.CLUSTER_NAME }}
          args: set image --record deployment/pod-name pod-name=${{ steps.build.outputs.IMAGE_URL }}
      # --- #
      - name: Use the output
        run: echo "${{ steps.kubectl.outputs.kubectl-out }}"

eks-kubectl-action's People

Contributors

ianbelcher avatar idobleicher avatar miguelaferreira avatar paulsambolin avatar valmirphp avatar

Watchers

 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.