0d17dff9ee
* refactor |
||
---|---|---|
.github | ||
src | ||
.gitignore | ||
CODE_OF_CONDUCT.md | ||
LICENSE | ||
README.md | ||
SECURITY.md | ||
action.yml | ||
jest.config.js | ||
package-lock.json | ||
package.json | ||
tsconfig.json |
README.md
Azure Kubernetes Service set context
This action can be used to set cluster context before other actions like azure/k8s-deploy
, azure/k8s-create-secret
or any kubectl commands (in script) can be run subsequently in the workflow.
Refer to starter templates to deploy to any Kubernetes cluster on-premise or any cloud including Azure Kubernetes service.
Action inputs
Action inputs | Description |
---|---|
creds Credentials |
(Required) Credentials required to authenticate with Azure. Steps to obtain these credentials are provided below |
resource-group Resource group |
(Required) Resource group containing the AKS cluster |
cluster-name Cluster name |
(Required) Name of the AKS cluster |
Example
uses: azure/aks-set-context@v1
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}' # Azure credentials
resource-group: '<resource group name>'
cluster-name: '<cluster name>'
id: login
To fetch the credentials required to authenticate with Azure, run the following command:
az ad sp create-for-rbac --sdk-auth
For more details on this command, refer to service principal documentation
This generates a service principal and the output of the above command will be in the following format:
{
"clientId": "<client id>",
"clientSecret": "<client secret>",
"subscriptionId": "<subscription id>",
"tenantId": "<tenant id>",
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
"resourceManagerEndpointUrl": "https://management.azure.com/",
"activeDirectoryGraphResourceId": "https://graph.windows.net/",
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
"galleryEndpointUrl": "https://gallery.azure.com/",
"managementEndpointUrl": "https://management.core.windows.net/"
}
Add the json output as a secret (let's say with the name AZURE_CREDENTIALS
) in the GitHub repository. The example YAML snippet given above showcases how this secret is referenced in the action for specifying the credentials as input to the action.
aks-set-context GitHub Actions is supported for the Azure public cloud as well as Azure government clouds ('AzureUSGovernment' or 'AzureChinaCloud'). Before running this action, login to the respective Azure Cloud using Azure Login by setting appropriate value for the environment
parameter.
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 opencode@microsoft.com with any additional questions or comments.