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.
It is a requirement to use azure/login
in your workflow before using this action.
There are three approaches for specifying the deployment target:
If inputs related to all these approaches are provided, kubeconfig approach related inputs are given precedence.
In all these approaches it is recommended to store these contents (kubeconfig file content or secret content) in a secret which could be referenced later in the action.
Action inputs Descriptionmethod
kubeconfig
context
k8s-url
k8s-secret
cluster-type
cluster-name
resource-group
token
- uses: azure/k8s-set-context@v1 with: method: kubeconfig kubeconfig: <your kubeconfig> # Use secret (https://developer.github.com/actions/managing-workflows/storing-secrets/) context: <context name> #If left unspecified, current-context from kubeconfig is used as default id: setcontext
Following are the ways to fetch kubeconfig file onto your local development machine so that the same can be used in the action input shown above:
For Azure Kubernetes Service clusteraz aks get-credentials --name --resource-group [--admin] [--file] [--overwrite-existing] [--subscription]
Further details can be found in az aks get-credentials documentation.
For any generic Kubernetes clusterPlease refer to documentation on fetching kubeconfig for any generic K8s cluster
- uses: azure/k8s-set-context@v1 with: method: service-account k8s-url: <URL of the clsuter's API server> k8s-secret: <secret associated with the service account> id: setcontext
For fetching Server URL, execute the following command on your shell:
kubectl config view --minify -o 'jsonpath={.clusters[0].cluster.server}'
For fetching Secret object required to connect and authenticate with the cluster, the following sequence of commands need to be run:
kubectl get serviceAccounts <service-account-name> -n <namespace> -o 'jsonpath={.secrets[*].name}'
kubectl get secret <service-account-secret-name> -n <namespace> -o yamlService account approach for arc cluster
- uses: azure/k8s-set-context@v1 with: method: service-account cluster-type: 'arc' cluster-name: <cluster-name> resource-group: <resource-group> token: '${{ secrets.SA_TOKEN }}' id: setcontextService principal approach for arc cluster
- uses: azure/k8s-set-context@v1 with: method: service-principal cluster-type: 'arc' cluster-name: <cluster-name> resource-group: <resource-group> id: setcontext
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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4