зеркало из https://github.com/Azure/k8s-actions.git
Родитель
4950e381dd
Коммит
44a9e653e6
|
@ -1,18 +1,17 @@
|
|||
# Usage
|
||||
|
||||
### AKS set context. Used for setting the target AKS cluster context which will be used by other actions like azure/k8s-actions/k8s-deploy or azure/k8s-actions/k8s-create-secret
|
||||
```yaml
|
||||
uses: azure/k8s-actions/aks-set-context@master
|
||||
with:
|
||||
creds: '<login to az, paste the output of `az ad sp create-for-rbac --sdk-auth` here>'
|
||||
subscriptionId: '<subscription id>'
|
||||
resourceGroupName: '<resource group name>'
|
||||
clusterName: '<cluster name>'
|
||||
id: login
|
||||
```
|
||||
|
||||
## creds object example
|
||||
## Creds object example
|
||||
Run `az ad sp create-for-rbac --sdk-auth` to generate the below object
|
||||
|
||||
For more details refer to https://docs.microsoft.com/en-us/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-create-for-rbac
|
||||
```json
|
||||
{
|
||||
"clientId": "<client id>",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: 'AKS set context'
|
||||
description: 'AKS set context'
|
||||
description: 'AKS set context. Used for setting the target AKS cluster context which will be used by other actions like azure/k8s-actions/k8s-deploy or azure/k8s-actions/k8s-create-secret '
|
||||
inputs:
|
||||
creds:
|
||||
description: 'Azure credentials i.e. output of `az ad sp create-for-rbac --sdk-auth`'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Usage
|
||||
|
||||
### Used for setting the target K8s cluster context which will be used by other actions like azure/k8s-actions/k8s-deploy or azure/k8s-actions/k8s-create-secret
|
||||
```yaml
|
||||
- uses: azure/actions/k8s-set-context@master
|
||||
with:
|
||||
|
@ -17,9 +17,32 @@
|
|||
```
|
||||
PS: `kubeconfig` takes precedence (i.e. kubeconfig would be created using the value supplied in kubeconfig)
|
||||
|
||||
###Steps to get certificate and token:
|
||||
## Steps to get Kubeconfig of a K8s cluster:
|
||||
|
||||
### For AKS
|
||||
```sh
|
||||
# Copy the secret name from the output of the get secret command
|
||||
~/$ kubectl get serviceaccounts <service-account-name> -o yaml
|
||||
~/$ kubectl get secret <service-account-secret-name> -o yaml
|
||||
az aks get-credentials --name
|
||||
--resource-group
|
||||
[--admin]
|
||||
[--file]
|
||||
[--overwrite-existing]
|
||||
[--subscription]
|
||||
```
|
||||
Refer to https://docs.microsoft.com/en-us/cli/azure/aks?view=azure-cli-latest#az-aks-get-credentials
|
||||
|
||||
### For any K8s cluster
|
||||
Please refer to https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/
|
||||
|
||||
|
||||
## Steps to get Service account:
|
||||
```sh
|
||||
# k8s-url: Run in your local shell to get server K8s URL
|
||||
kubectl config view --minify -o jsonpath={.clusters[0].cluster.server}
|
||||
|
||||
# k8s-secret: Run following sequential commands to get the secret value:
|
||||
Get service account secret names by running
|
||||
kubectl get serviceAccounts <service-account-name> -n <namespace> -o=jsonpath={.secrets[*].name}
|
||||
|
||||
Use the output of the above command
|
||||
kubectl get secret <service-account-secret-name> -n <namespace> -o json
|
||||
```
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
name: 'Kubernetes set context'
|
||||
description: 'Kubernetes set context'
|
||||
inputs:
|
||||
# Used for setting the target K8s cluster context which will be used by other actions like azure/k8s-actions/k8s-deploy or azure/k8s-actions/k8s-create-secret
|
||||
kubeconfig:
|
||||
description: 'Kubernetes Config'
|
||||
required: false
|
||||
|
|
Загрузка…
Ссылка в новой задаче