SYNOPSIS
# Requires a working kubeconfig and LANGERTHA_ANTHROPIC_API_KEY
LANGERTHA_ANTHROPIC_API_KEY=sk-ant-... perl -Ilib examples/raider-configmap-demo.pl
# With specific context/namespace
MCP_K8S_CONTEXT=my-cluster MCP_K8S_NAMESPACES=default \
LANGERTHA_ANTHROPIC_API_KEY=sk-ant-... perl -Ilib examples/raider-configmap-demo.pl
DESCRIPTION
This script demonstrates MCP::K8s + Langertha::Raider working together: a real AI assistant uses the MCP tools to perform a safe, harmless operation on your Kubernetes cluster.
What it does:
- 1. Discovers RBAC permissions (calls
k8s_permissions) - 2. Creates a ConfigMap named
mcp-k8s-demowith test data - 3. Reads the ConfigMap back to verify it was created
- 4. Updates it with new data using
k8s_apply - 5. Deletes the ConfigMap to clean up
The entire lifecycle is driven by the AI — it decides which tools to call based on the instructions. Tool calls and timing are printed live.
Requirements:
LANGERTHA_ANTHROPIC_API_KEYenvironment variable setA kubeconfig with access to at least one namespace (or
MCP_K8S_TOKEN)create,get,patch,deletepermissions onconfigmaps
Safety: Only creates a single ConfigMap with test data. Cleans up after itself. No pods, deployments, or anything compute-related.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 36:
Non-ASCII character seen before =encoding in '—'. Assuming UTF-8