Deploying Claude Code¶
Claude Code is Anthropic's agentic coding tool. The claude-code runtime is bundled with Language Operator and installed automatically with the Helm chart. It exposes a WebSocket terminal via ttyd, so you can connect directly to Claude Code's interactive CLI from any browser or WebSocket client.
Prerequisites¶
- Language Operator installed
- An Anthropic API key (get one here)
Instructions¶
Get an API Key¶
- Go to console.anthropic.com/settings/keys
- Click Create Key, give it a name, and copy the key (
sk-ant-...)
Claude Code makes direct API calls to Anthropic, so you need an API key with access to the model you want to use (e.g. claude-sonnet-4-6).
Create a Cluster¶
kubectl apply -f - <<EOF
apiVersion: langop.io/v1alpha1
kind: LanguageCluster
metadata:
name: demo-cluster
spec:
domain: demo-cluster.<your-domain>
EOF
kubectl wait languagecluster/demo-cluster --for=condition=Ready --timeout=60s
kubectl config set-context --current --namespace=demo-cluster
Store Your API Key¶
Deploy Claude Code¶
kubectl apply -f - <<EOF
apiVersion: langop.io/v1alpha1
kind: LanguageAgent
metadata:
name: code-agent
spec:
runtime: claude-code
instructions: |
You are an expert software engineer. Help with code review,
debugging, and implementation tasks.
claudeCode:
apiKeyRef:
name: anthropic-credentials
EOF
The apiKeyRef tells the operator to read the api-key key from your secret and inject it as ANTHROPIC_API_KEY into the pod — traffic goes straight to Anthropic, bypassing the shared gateway.
Verify¶
Wait for the pod to reach Running and the LanguageAgent to show Ready=True.
Connect to the Terminal¶
The agent exposes a WebSocket terminal on port 8080. Port-forward to access it locally:
Then open http://localhost:8080 in your browser. You'll see Claude Code's interactive CLI running inside the pod.
Using the Shared Gateway Instead¶
Not currently supported. Claude Code 2.x sends
Authorization: Bearer(OAuth format) whenANTHROPIC_BASE_URLis set. Anthropic's API rejects OAuth authentication, so routing through the LiteLLM gateway fails at the model-call level. UseclaudeCode.apiKeyRef(orspec.deployment.env) to supply a real API key and let Claude Code call Anthropic directly.
Configuration Reference¶
| Field | Description |
|---|---|
spec.claudeCode.apiKeyRef.name |
Secret name containing the API key. The operator reads the key specified by apiKeyRef.key (default api-key) and injects it as ANTHROPIC_API_KEY. Recommended for direct Anthropic access. |
spec.claudeCode.apiKeyRef.key |
Key within the secret (default: api-key). Override if your secret uses a different key name. |
spec.claudeCode.apiKey |
Inline API key (stored in a managed Secret). Use apiKeyRef instead if the key is already in a Secret. |
spec.claudeCode.enabled |
Set automatically by the claude-code runtime. No need to set this manually. |
What the Operator Created¶
| Resource | Name | Purpose |
|---|---|---|
| Deployment | code-agent |
Runs the Claude Code ttyd terminal container |
| Service | code-agent |
ClusterIP on port 8080 (ttyd WebSocket terminal) |
| NetworkPolicy | code-agent |
Allows inbound from other agents in this namespace. Add spec.networkPolicies.egress with cidr: 0.0.0.0/0 on port 443 to reach api.anthropic.com and other public APIs. |
| PVC | code-agent-workspace |
10Gi persistent workspace at /workspace |
| ConfigMap | code-agent-agent |
Injected at /etc/agent/config.yaml |