|
| 1 | +# coding=utf-8 |
| 2 | +# -------------------------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the MIT License. See License.txt in the project root for license information. |
| 5 | +# -------------------------------------------------------------------------------------------- |
| 6 | + |
| 7 | +# pylint: disable=too-many-lines |
| 8 | + |
| 9 | +from knack.help_files import helps |
| 10 | + |
| 11 | + |
| 12 | +helps[ |
| 13 | + "aks agent" |
| 14 | +] = """ |
| 15 | + type: command |
| 16 | + short-summary: Run AI assistant to analyze and troubleshoot Kubernetes clusters. |
| 17 | + long-summary: |- |
| 18 | + This command allows you to ask questions about your Azure Kubernetes cluster and get answers using AI models. |
| 19 | + Environment variables must be set to use the AI model, please refer to https://docs.litellm.ai/docs/providers to learn more about supported AI providers and models and required environment variables. |
| 20 | + parameters: |
| 21 | + - name: --name -n |
| 22 | + type: string |
| 23 | + short-summary: Name of the managed cluster. |
| 24 | + - name: --resource-group -g |
| 25 | + type: string |
| 26 | + short-summary: Name of the resource group. |
| 27 | + - name: --model |
| 28 | + type: string |
| 29 | + short-summary: Model to use for the LLM. |
| 30 | + - name: --api-key |
| 31 | + type: string |
| 32 | + short-summary: API key to use for the LLM (if not given, uses environment variables AZURE_API_KEY, OPENAI_API_KEY). |
| 33 | + - name: --config-file |
| 34 | + type: string |
| 35 | + short-summary: Path to configuration file. |
| 36 | + - name: --max-steps |
| 37 | + type: int |
| 38 | + short-summary: Maximum number of steps the LLM can take to investigate the issue. |
| 39 | + - name: --no-interactive |
| 40 | + type: bool |
| 41 | + short-summary: Disable interactive mode. When set, the agent will not prompt for input and will run in batch mode. |
| 42 | + - name: --no-echo-request |
| 43 | + type: bool |
| 44 | + short-summary: Disable echoing back the question provided to AKS Agent in the output. |
| 45 | + - name: --show-tool-output |
| 46 | + type: bool |
| 47 | + short-summary: Show the output of each tool that was called during the analysis. |
| 48 | + - name: --refresh-toolsets |
| 49 | + type: bool |
| 50 | + short-summary: Refresh the toolsets status. |
| 51 | +
|
| 52 | + examples: |
| 53 | + - name: Ask about pod issues in the cluster with Azure OpenAI |
| 54 | + text: |- |
| 55 | + export AZURE_API_BASE="https://my-azureopenai-service.openai.azure.com/" |
| 56 | + export AZURE_API_VERSION="2025-01-01-preview" |
| 57 | + export AZURE_API_KEY="sk-xxx" |
| 58 | + az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup --model azure/my-gpt4.1-deployment |
| 59 | + - name: Ask about pod issues in the cluster with OpenAI |
| 60 | + text: |- |
| 61 | + export OPENAI_API_KEY="sk-xxx" |
| 62 | + az aks agent "Why are my pods not starting?" --name MyManagedCluster --resource-group MyResourceGroup --model gpt-4o |
| 63 | + - name: Run in interactive mode without a question |
| 64 | + text: az aks agent "Check the pod status in my cluster" --name MyManagedCluster --resource-group MyResourceGroup --model azure/my-gpt4.1-deployment --api-key "sk-xxx" |
| 65 | + - name: Run in non-interactive batch mode |
| 66 | + text: az aks agent "Diagnose networking issues" --no-interactive --max-steps 15 --model azure/my-gpt4.1-deployment |
| 67 | + - name: Show detailed tool output during analysis |
| 68 | + text: az aks agent "Why is my service workload unavailable in namespace workload-ns?" --show-tool-output --model azure/my-gpt4.1-deployment |
| 69 | + - name: Use custom configuration file |
| 70 | + text: az aks agent "Check kubernetes pod resource usage" --config-file /path/to/custom.yaml --model azure/my-gpt4.1-deployment |
| 71 | + - name: Run agent with no echo of the original question |
| 72 | + text: az aks agent "What is the status of my cluster?" --no-echo-request --model azure/my-gpt4.1-deployment |
| 73 | + - name: Refresh toolsets to get the latest available tools |
| 74 | + text: az aks agent "What is the status of my cluster?" --refresh-toolsets --model azure/my-gpt4.1-deployment |
| 75 | + - name: Run agent with config file |
| 76 | + text: | |
| 77 | + az aks agent "Check kubernetes pod resource usage" --config-file /path/to/custom.yaml |
| 78 | + Here is an example of config file: |
| 79 | + ```json |
| 80 | + model: "gpt-4o" |
| 81 | + api_key: "..." |
| 82 | + # define a list of mcp servers, mcp server can be defined |
| 83 | + mcp_servers: |
| 84 | + aks_mcp: |
| 85 | + description: "The AKS-MCP is a Model Context Protocol (MCP) server that enables AI assistants to interact with Azure Kubernetes Service (AKS) clusters" |
| 86 | + url: "http://localhost:8003/sse" |
| 87 | +
|
| 88 | + # try adding your own tools or toggle the built-in toolsets here |
| 89 | + # e.g. query company-specific data, fetch logs from your existing observability tools, etc |
| 90 | + # To check how to add a customized toolset, please refer to https://docs.robusta.dev/master/configuration/holmesgpt/custom_toolsets.html#custom-toolsets |
| 91 | + # To find all built-in toolsets, please refer to https://docs.robusta.dev/master/configuration/holmesgpt/builtin_toolsets.html |
| 92 | + toolsets: |
| 93 | + # add a new json processor toolset |
| 94 | + json_processor: |
| 95 | + description: "A toolset for processing JSON data using jq" |
| 96 | + prerequisites: |
| 97 | + - command: "jq --version" # Ensure jq is installed |
| 98 | + tools: |
| 99 | + - name: "process_json" |
| 100 | + description: "A tool that uses jq to process JSON input" |
| 101 | + command: "echo '{{ json_input }}' | jq '.'" # Example jq command to format JSON |
| 102 | + # disable a built-in toolsets |
| 103 | + aks/core: |
| 104 | + enabled: false |
| 105 | + ``` |
| 106 | +""" |
0 commit comments