GithubHelp home page GithubHelp logo

azure / aks-set-context Goto Github PK

View Code? Open in Web Editor NEW
42.0 18.0 33.0 29.65 MB

GitHub Action for setting context (retrieving Kubeconfig) before interacting with Kubernetes cluster

License: MIT License

JavaScript 2.88% TypeScript 97.12%
actions azure deploy github-action github-actions k8s kubernetes

aks-set-context's Introduction

Azure Kubernetes Service set context

This action can be used to set cluster context before other actions like azure/k8s-deploy and azure/k8s-create-secret. Any kubectl commands (in script) can also be run subsequently in the workflow.

You must run Azure/login before this action.

Action inputs

Action inputs Description
resource-group
(Required)
Resource group containing the AKS cluster
cluster-name
(Required)
Name of the AKS cluster
subscription Subscription tied to AKS cluster
admin Get cluster admin credentials. Values: true or false
use-kubelogin Allows non-admin users to use the Action via kubelogin
public-fqdn Get private cluster credential with server address to be public fqdn

Example

OIDC Authentication (recommended)

- uses: azure/login@v1
  with:
     client-id: ${{ secrets.AZURE_CLIENT_ID }}
     tenant-id: ${{ secrets.AZURE_TENANT_ID }}
     subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- uses: azure/aks-set-context@v3
  with:
     resource-group: '<resource group name>'
     cluster-name: '<cluster name>'

Service Principal Authentication

- uses: azure/login@v1
  with:
     creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/aks-set-context@v3
  with:
     resource-group: '<resource group name>'
     cluster-name: '<cluster name>'

Kubelogin

kubelogin is at the core of the non-admin user scenario. For more information on kubelogin, refer to the documentation here.

To run this Action as a non-admin user, you must first install kubelogin. To set up kubelogin, you may use the action azure/use-kubelogin:

- name: Set up kubelogin for non-interactive login
  uses: azure/use-kubelogin@v1
  with:
     kubelogin-version: 'v0.0.24'

Non-Admin User Example

If you are executing this Action as a non-admin user, you need to toggle the optional use-kubelogin Action input to true for it to work.

- uses: azure/login@v1
  with:
     client-id: ${{ secrets.AZURE_CLIENT_ID }}
     tenant-id: ${{ secrets.AZURE_TENANT_ID }}
     subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- uses: azure/aks-set-context@v3
  with:
     resource-group: '<resource group name>'
     cluster-name: '<cluster name>'
     admin: 'false'
     use-kubelogin: 'true'
- uses: azure/login@v1
  with:
     creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/aks-set-context@v3
  with:
     resource-group: '<resource group name>'
     cluster-name: '<cluster name>'
     admin: 'false'
     use-kubelogin: 'true'

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Support

aks-set-context is an open source project that is not covered by the Microsoft Azure support policy. Please search open issues here, and if your issue isn't already represented please open a new one. The project maintainers will respond to the best of their abilities.

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.