Update README.md

This commit is contained in:
Deepak Sattiraju
2019-09-23 13:56:32 +05:30
committed by GitHub
parent faa1b7c540
commit 77c7db379b

View File

@ -3,7 +3,7 @@
Used for setting the target K8s cluster context which will be used by other actions like [`azure/k8s-deploy`](https://github.com/Azure/k8s-actions/tree/master/k8s-deploy), [`azure/k8s-create-secret`](https://github.com/Azure/k8s-actions/tree/master/k8s-create-secret) etc. or run any kubectl commands. Used for setting the target K8s cluster context which will be used by other actions like [`azure/k8s-deploy`](https://github.com/Azure/k8s-actions/tree/master/k8s-deploy), [`azure/k8s-create-secret`](https://github.com/Azure/k8s-actions/tree/master/k8s-create-secret) etc. or run any kubectl commands.
```yaml ```yaml
- uses: azure/k8s-actions/k8s-set-context@master - uses: azure/k8s-set-context@v1
with: with:
kubeconfig: '<your kubeconfig>'v# Use secret (https://developer.github.com/actions/managing-workflows/storing-secrets/) kubeconfig: '<your kubeconfig>'v# Use secret (https://developer.github.com/actions/managing-workflows/storing-secrets/)
context: '<context name>' # Optional, uses the current-context from kubeconfig by default context: '<context name>' # Optional, uses the current-context from kubeconfig by default
@ -11,14 +11,14 @@ Used for setting the target K8s cluster context which will be used by other acti
``` ```
```yaml ```yaml
- uses: azure/k8s-actions/k8s-set-context@master - uses: azure/k8s-set-context@v1
with: with:
k8s-url: '<your kubernetes cluster url>' k8s-url: '<your kubernetes cluster url>'
k8s-secret: '<service account token>' # token value from the result of the below script k8s-secret: '<service account token>' # token value from the result of the below script
id: login id: login
``` ```
Use secret (https://developer.github.com/actions/managing-workflows/storing-secrets/) in workflow for kubeconfig or k8s-values. [Use secrets](https://developer.github.com/actions/managing-workflows/storing-secrets/) in workflow for using kubeconfig or k8s-values.
PS: `kubeconfig` takes precedence (i.e. kubeconfig would be created using the value supplied in kubeconfig) PS: `kubeconfig` takes precedence (i.e. kubeconfig would be created using the value supplied in kubeconfig)
@ -60,7 +60,7 @@ kubectl get secret <service-account-secret-name> -n <namespace> -o json
## Using secret for Kubeconfig or Service Account ## Using secret for Kubeconfig or Service Account
Now add the values as [a secret](https://developer.github.com/actions/managing-workflows/storing-secrets/) in the GitHub repository. In the example below the secret name is `KUBE_CONFIG` and it can be used in the workflow by using the following syntax: Now add the values as [a secret](https://developer.github.com/actions/managing-workflows/storing-secrets/) in the GitHub repository. In the example below the secret name is `KUBE_CONFIG` and it can be used in the workflow by using the following syntax:
```yaml ```yaml
- uses: azure/k8s-actions/k8s-set-context@master - uses: azure/k8s-set-context@v1
with: with:
kubeconfig: ${{ secrets.KUBE_CONFIG }} kubeconfig: ${{ secrets.KUBE_CONFIG }}
``` ```