连接 Provider
要连接到 Azure AKS,请按照以下步骤操作:
- 登录您的 Azure 账户。
- 进入您的 Kubernetes 服务页面,点击
连接按钮,然后点击打开 Cloud Shell。 - 在云 shell 中运行
az ad sp create-for-rbac --role owner --scopes /subscriptions/<YOUR_SUBSCRIPTION_ID>,您将收到类似以下的响应:在上述 JSON 对象中,{ "appId": "xxxxxx-xxxxx-xxxxxx-xxxx", "displayName": "azure-cli-2023-11-06-13-00-52", "password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "tenant": "xxxxx-xxxxx-xxxx-xxxxx" }appId是client_id,password是client_secret,tenant是tenant_id。
注意事项
- 此 Provider 允许您与 Azure AKS 交互以查询 Kubernetes 集群中的资源。
认证
此提供商需要身份验证。
- subscription_id: Azure 订阅 ID(必需:True,敏感:True)
- client_id: Azure 客户端 ID(必需:True,敏感:True)
- client_secret: Azure 客户端密钥(必需:True,敏感:True)
- tenant_id: Azure 租户 ID(必需:True,敏感:True)
- resource_group_name: Azure AKS 资源组名称(必需:True,敏感:True)
- resource_name: Azure AKS 集群名称(必需:True,敏感:True)
在工作流中
此提供商可用于工作流。
作为"步骤"来查询数据,示例:
yaml
steps:
- name: Query aks
provider: aks
config: "{{ provider.my_provider_name }}"
with:
command_type: {value} # 在 k8s 集群上操作的命令类型(`get_pods`、`get_pvc`、`get_node_pressure`)。请查看以下工作流示例: