# 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. There are two 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 both these approaches are provided, kubeconfig approach related inputs are given precedence. In both 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/SPN. Default value: kubeconfig |
kubeconfig Kubectl config |
(Relevant for kubeconfig approach) Configuration file to be used with kubectl |
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 |
creds Service principal credentials for az login |
Provide json output of 'az ad sp create-for-rbac --sdk-auth' command |
cluster-name Name of arc cluster |
Provide name of arc cluster.Applicable for cluster-type of 'arc'. |
resource-group resource group |
Provide name of resource group that contains the arc cluster.Applicable for cluster-type of 'arc'. |
token Service account token |
Applicable for 'service-account' method. |