# Kubernetes set context This action can be used to set cluster context before other actions like [`azure/k8s-deploy`](https://github.com/Azure/k8s-deploy/tree/master), [`azure/k8s-create-secret`](https://github.com/Azure/k8s-create-secret/tree/master) or any kubectl commands (in script) can be run subsequently in the workflow. It is a requirement to use [`azure/login`](https://github.com/Azure/login/tree/master) in your workflow before using this action. There are three approaches for specifying the deployment target: - Kubeconfig file provided as input to the action - Service account approach where the secret associated with the service account is provided as input to the action - Service principal approach(only applicable for arc cluster) where service principal provided with 'creds' is used as input to action 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](https://developer.github.com/actions/managing-workflows/storing-secrets/) which could be referenced later in the action. ## Action inputs
Action inputs | Description |
---|---|
method Method |
(Optional) Acceptable values: kubeconfig/service-account/service-principal. Default value: kubeconfig |
kubeconfig Kubectl config |
(Relevant for kubeconfig approach) Contents of the configuration file to be used with kubectl (e.g. can be pulled from a secret) |
context Context |
(Relevant for kubeconfig approach) Context to be used within the provided kubeconfig file |
k8s-url API server URL |
(Relevant for service account approach) API Server URL for the K8s cluster |
k8s-secret Secret |
(Relevant for service account approach) Secret associated with the service account to be used for deployments |
cluster-type Type of cluster |
Type of cluster. Acceptable values: generic/arc |
cluster-name Name of arc cluster |
Name of Azure Arc enabled Kubernetes cluster. Required only if cluster-type is 'arc'. |
resource-group resource group |
Resource group containing the Azure Arc enabled Kubernetes cluster. Required only if cluster-type is 'arc'. |
token Service account token |
Applicable for 'service-account' method. |