Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions specs/kagent/DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,34 @@ server (`internal/acp/server/kagent_mcp.go`). Two consequences worth knowing:
`EgressPolicy` in the rendered manifest), and an Agent must reference it via
`spec.egressPolicyRefs`. Without that reference the policy is inert.

The AgentTemplate also mounts kagent's two built-in MCP servers:
`kagent-tool-server` (Kubernetes, Helm, Istio, Cilium, Argo Rollouts, Prometheus
and shell tools, run by a cluster-admin ServiceAccount in the default chart) and
`kagent-api` (Agent Substrate sandboxes, sessions and checkpoints). They are
in-cluster `http://` origins, which the rendered `pi-go-tools-egress` policy
grants.

`pi-go-devtools-egress` allows developer downloads project by project: Kubernetes
(`dl.k8s.io`, chart repos), kagent and Agent Substrate (`kagent.dev`, `ghcr.io`),
agentgateway (`agentgateway.dev`, `cr.agentgateway.dev`), Helm, and every host
`arkade get` and `arkade install` fetch from outside github.com (taken from
alexellis/arkade `pkg/get/tools.go` and `pkg/apps`). There are no wildcards. An
origin grants its whole host, so github.com and ghcr.io cannot be narrowed to one
organisation; that needs a filtering proxy.

Give each Agent the policies it needs:

```yaml
spec:
egressPolicyRefs:
- name: github-egress
- name: pi-go-tools-egress # kagent tools + Substrate MCP
- name: pi-go-devtools-egress # downloads
```

Override the names with `--tool-server`, `--api-server`, `--tools-service`,
`--tools-egress-name` and `--devtools-egress-name` if your kagent install differs.

## Option A: local registry (recommended)

The local kagent Kind setup uses a registry reachable as `localhost:5001` from
Expand Down
98 changes: 98 additions & 0 deletions specs/kagent/manifests.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ spec:
systemPrompt: |
You are pi-go, a helpful coding and Kubernetes assistant.
Use tools carefully and explain actions briefly.
# kagent's built-in MCP servers, both installed by the kagent Helm chart:
# - ${PI_GO_TOOL_SERVER}: Kubernetes, Helm, Istio, Cilium, Argo Rollouts and
# Prometheus tools plus a shell, run by the kagent-tools ServiceAccount
# (cluster-admin in the default chart, so every tool here can change the
# cluster).
# - ${PI_GO_API_SERVER}: the controller's MCP, with Agent Substrate
# sandboxes, sessions and checkpoints.
# A BYO harness reaches them only through the tools EgressPolicy below.
tools:
- mcp:
server:
kind: RemoteMCPServer
name: ${PI_GO_TOOL_SERVER}
- mcp:
server:
kind: RemoteMCPServer
name: ${PI_GO_API_SERVER}
---
# Egress for the MCP servers an AgentTemplate may declare. A BYO runtime gets
# its credentials from the compiler as KAGENT_ENV[...] placeholders inside
Expand Down Expand Up @@ -85,3 +102,84 @@ spec:
- origin: https://raw.githubusercontent.com
- origin: https://codeload.github.com
- origin: https://objects.githubusercontent.com
# github.com/<owner>/<repo>/releases/download/... redirects here.
- origin: https://release-assets.githubusercontent.com
---
# Egress for the in-cluster MCP servers the AgentTemplate declares. Like the
# policy above it is inert until an Agent lists it in spec.egressPolicyRefs. An
# actor's DNS resolves only the hostnames its policies name, so without this
# the template's tools fail to connect.
apiVersion: api.kagent.dev/v1alpha3
kind: EgressPolicy
metadata:
name: ${PI_GO_TOOLS_EGRESS_NAME}
namespace: ${PI_GO_NAMESPACE}
spec:
destinations:
- origin: http://${PI_GO_TOOLS_SERVICE}.${PI_GO_NAMESPACE}.svc.cluster.local:8084
- origin: http://${PI_GO_CONTROLLER}.${PI_GO_NAMESPACE}.svc.cluster.local:8083
---
# Developer downloads, allowed project by project rather than by wildcard
# (no *.github.io, no *.googleapis.com). An origin grants its whole host: a
# rule cannot narrow github.com or ghcr.io to one organisation's paths, so
# those stay as wide as the hosts themselves. Registry layers on ghcr.io and
# cr.agentgateway.dev are served from pkg-containers.githubusercontent.com
# (both answer blob requests with a 307 there). GitHub itself, including
# release downloads, is in the GitHub policy above.
apiVersion: api.kagent.dev/v1alpha3
kind: EgressPolicy
metadata:
name: ${PI_GO_DEVTOOLS_EGRESS_NAME}
namespace: ${PI_GO_NAMESPACE}
spec:
destinations:
# Kubernetes: kubectl, kubeadm and release binaries; official chart repos
- origin: https://dl.k8s.io
- origin: https://kubernetes.github.io
- origin: https://kubernetes-sigs.github.io
# kagent and Agent Substrate: docs and install scripts; images and OCI Helm charts on ghcr.io (layers are served from pkg-containers.githubusercontent.com)
- origin: https://kagent.dev
- origin: https://ghcr.io
- origin: https://pkg-containers.githubusercontent.com
# agentgateway: docs and install scripts; images and charts (layers also served from pkg-containers.githubusercontent.com)
- origin: https://agentgateway.dev
- origin: https://cr.agentgateway.dev
# Helm
- origin: https://get.helm.sh
# arkade installer (get.arkade.dev); arkade releases themselves come from github.com (github-egress)
- origin: https://get.arkade.dev
# arkade get: CLI downloads that are not on github.com (alexellis/arkade pkg/get/tools.go)
- origin: https://releases.hashicorp.com
- origin: https://mirror.openshift.com
- origin: https://storage.googleapis.com
- origin: https://static.ampcode.com
- origin: https://releases.crossplane.io
- origin: https://packages.konghq.com
- origin: https://gitlab.com
- origin: https://dl.influxdata.com
- origin: https://cache.agilebits.com
- origin: https://opencode.ai
# arkade install: Helm chart repositories (alexellis/arkade pkg/apps)
- origin: https://argoproj.github.io
- origin: https://bitnami-labs.github.io
- origin: https://charts.bitnami.com
- origin: https://charts.cockroachdb.com
- origin: https://charts.crossplane.io
- origin: https://charts.gitlab.io
- origin: https://charts.jenkins.io
- origin: https://charts.jetstack.io
- origin: https://charts.konghq.com
- origin: https://confluentinc.github.io
- origin: https://crossplaneio.github.io
- origin: https://dl.gitea.io
- origin: https://falcosecurity.github.io
- origin: https://grafana.github.io
- origin: https://inlets.github.io
- origin: https://kumahq.github.io
- origin: https://kyverno.github.io
- origin: https://open-policy-agent.github.io
- origin: https://openfaas.github.io
- origin: https://portainer.github.io
- origin: https://prometheus-community.github.io
- origin: https://traefik.github.io
- origin: https://twuni.github.io
21 changes: 21 additions & 0 deletions specs/kagent/render-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ controller_name="kagent-controller"
# they exist whether or not this render wires up an Agent.
egress_name="github-egress"
github_secret="github-mcp-token"
# kagent's built-in MCP servers (RemoteMCPServer names from the kagent Helm
# chart), the Service behind the tool server, and the EgressPolicy that lets
# a BYO actor reach them and dl.k8s.io.
tool_server="kagent-tool-server"
api_server="kagent-api"
tools_service="kagent-tools"
tools_egress_name="pi-go-tools-egress"
# Per-project developer download hosts: Kubernetes, kagent and Substrate,
# agentgateway, Helm and everything arkade get/install fetches.
devtools_egress_name="pi-go-devtools-egress"
# Defaults suit the local Kind Substrate; a release renders with --no-env so
# the published manifest carries no cluster-specific endpoint.
model="ollama/deepseek-v4-flash:0731-cloud"
Expand All @@ -52,6 +62,11 @@ while [ $# -gt 0 ]; do
--controller) controller_name="${2:?--controller needs a value}"; shift 2 ;;
--egress-name) egress_name="${2:?--egress-name needs a value}"; shift 2 ;;
--github-secret) github_secret="${2:?--github-secret needs a value}"; shift 2 ;;
--tool-server) tool_server="${2:?--tool-server needs a value}"; shift 2 ;;
--api-server) api_server="${2:?--api-server needs a value}"; shift 2 ;;
--tools-service) tools_service="${2:?--tools-service needs a value}"; shift 2 ;;
--tools-egress-name) tools_egress_name="${2:?--tools-egress-name needs a value}"; shift 2 ;;
--devtools-egress-name) devtools_egress_name="${2:?--devtools-egress-name needs a value}"; shift 2 ;;
--model) model="${2:?--model needs a value}"; shift 2 ;;
--base-url) base_url="${2:?--base-url needs a value}"; shift 2 ;;
--no-env) want_env=0; shift ;;
Expand Down Expand Up @@ -103,6 +118,12 @@ render() {
-e "s|\${PI_GO_MODEL_CONFIG}|${model_config}|g" \
-e "s|\${PI_GO_EGRESS_NAME}|${egress_name}|g" \
-e "s|\${PI_GO_GITHUB_SECRET}|${github_secret}|g" \
-e "s|\${PI_GO_TOOL_SERVER}|${tool_server}|g" \
-e "s|\${PI_GO_API_SERVER}|${api_server}|g" \
-e "s|\${PI_GO_TOOLS_SERVICE}|${tools_service}|g" \
-e "s|\${PI_GO_TOOLS_EGRESS_NAME}|${tools_egress_name}|g" \
-e "s|\${PI_GO_DEVTOOLS_EGRESS_NAME}|${devtools_egress_name}|g" \
-e "s|\${PI_GO_CONTROLLER}|${controller_name}|g" \
"$template" \
| PI_GO_ENV_BLOCK="$env_block" awk '
$0 == "${PI_GO_ENV_BLOCK}---" {
Expand Down
Loading