For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.
Build a K8s SRE
Build a Kubernetes SRE agent in the kagent UI that investigates the cluster on its own and asks for approval before it changes anything.
Build an agent that works like a careful site reliability engineer. It reads the cluster on its own to find out what is wrong, and it stops to ask you before it changes anything.
kagent installs an MCP server, kagent-tool-server, with tools for Kubernetes. You give the agent two sets of those tools: read-only tools that it can call freely, and tools that change the cluster, which need your approval on every call.
Before you begin
- Install kagent.
- Open the kagent UI with
kagent dashboard.
Create the agent

In the sidebar, click Agents, and then click New Agent.
In the Name field, enter
k8s-sre. Leave the Namespace askagent, and leave Shared harness set tokagent-default.In the Template section, select Inline, and fill in the template.
Field Value Model configuration kagent/default-model-configDescription Kubernetes SRE that investigates before it actsIn the System prompt field, enter the following prompt.
You are a Kubernetes site reliability engineer. Investigate with your read-only tools before you suggest a change. Explain what you found, then propose the smallest fix. Never guess. When the tools cannot answer, say so.
Give it read-only tools
Under Tools from MCP servers, click Add an MCP server, and choose
kagent/kagent-tool-serverfrom the MCP server list.From the tool list beside it, choose the tools that only read. Type part of a name to find a tool.
Tool What it does k8s_get_resourcesLists resources, such as pods and deployments. k8s_describe_resourceDescribes one resource. k8s_get_eventsReads events. k8s_get_pod_logsReads the logs of a pod. Leave Require approval cleared for this set.
Give it tools that need approval
Click Add an MCP server again, and choose
kagent/kagent-tool-servera second time.From the tool list, choose
k8s_scaleandk8s_rollout.Select Require approval. The agent now pauses before each of these tools runs, and waits for you to approve or reject the call.
Click Create agent, and then click Refresh until the agent is Ready.
Ask it about the cluster
Click the agent name,
k8s-sre, to open its chat page.Ask a question that the read-only tools can answer, such as
Are any pods in the kagent namespace unhealthy?Ask for a change, such as
Scale the kagent-ui deployment to 2 replicas.The agent asks for your approval before it callsk8s_scale.
YAML version
Everything that you did in the UI is stored as Kubernetes resources. To create the same resources from the command line, or to keep them in a Git repository, apply this YAML.
The k8s-sre agent, with both sets of tools
kubectl apply -f - <<EOF
apiVersion: api.kagent.dev/v1alpha3
kind: Agent
metadata:
name: k8s-sre
namespace: kagent
spec:
harnessRef:
name: kagent-default
template:
inline:
description: Kubernetes SRE that investigates before it acts
modelConfig:
name: default-model-config
systemPrompt: |-
You are a Kubernetes site reliability engineer.
Investigate with your read-only tools before you suggest a change.
Explain what you found, then propose the smallest fix.
Never guess. When the tools cannot answer, say so.
tools:
- mcp:
server:
kind: RemoteMCPServer
name: kagent-tool-server
tools:
- k8s_get_resources
- k8s_describe_resource
- k8s_get_events
- k8s_get_pod_logs
- mcp:
requireApproval: true
server:
kind: RemoteMCPServer
name: kagent-tool-server
tools:
- k8s_scale
- k8s_rollout
EOF