k8s-actions/aks-set-context/README.md

39 строки
2.0 KiB
Markdown
Исходник Постоянная ссылка Обычный вид История

# Azure Kubernetes Service set context
2019-07-31 15:55:11 +03:00
2019-08-08 12:36:31 +03:00
Used for setting the target AKS cluster context which will be used by other actions like [`azure/k8s-actions/k8s-deploy`](https://github.com/Azure/k8s-actions/tree/master/k8s-deploy), [`azure/k8s-actions/k8s-create-secret`](https://github.com/Azure/k8s-actions/tree/master/k8s-create-secret) etc. or run any [kubectl] (https://kubernetes.io/docs/reference/kubectl/overview/) commands.
2019-07-31 15:57:40 +03:00
```yaml
uses: azure/k8s-actions/aks-set-context@master
with:
2019-08-08 13:34:31 +03:00
creds: '${{ secrets.AZURE_CREDENTIALS }}' # Azure credentials
2019-09-10 17:43:48 +03:00
resource-group-name: '<resource group name>'
cluster-name: '<cluster name>'
id: login
```
2019-08-08 13:36:10 +03:00
Refer to the action metadata file for details about all the inputs https://github.com/Azure/k8s-actions/blob/master/aks-set-context/action.yml
2019-08-08 13:33:21 +03:00
2019-08-08 13:34:31 +03:00
## Azure credentials
2019-08-08 12:36:31 +03:00
Run `az ad sp create-for-rbac --sdk-auth` to generate an Azure Active Directory service principals.
2019-07-31 15:55:11 +03:00
For more details refer to: [az ad sp create-for-rbac](https://docs.microsoft.com/en-us/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-create-for-rbac)
2019-08-08 12:36:31 +03:00
```json
{
2019-07-31 14:19:18 +03:00
"clientId": "<client id>",
"clientSecret": "<client secret>",
"subscriptionId": "<subscription id>",
"tenantId": "<tenant id>",
2019-08-08 13:30:44 +03:00
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com",
2019-07-31 14:19:18 +03:00
"resourceManagerEndpointUrl": "https://management.azure.com/",
"activeDirectoryGraphResourceId": "https://graph.windows.net/",
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/",
"galleryEndpointUrl": "https://gallery.azure.com/",
"managementEndpointUrl": "https://management.core.windows.net/"
}
2019-07-31 15:55:11 +03:00
```
2019-08-08 13:00:01 +03:00
## Using secret
2019-08-08 12:36:31 +03:00
Now add the json output as [a secret](https://developer.github.com/actions/managing-workflows/storing-secrets/) in the GitHub repository. In the above example the secret name is `AZURE_CREDENTIALS` and it can be used in the workflow by using the following syntax:
```yaml
creds: '${{ secrets.AZURE_CREDENTIALS }}'
```