Command Generation
Overview
OpsWorker generates specific kubectl commands tailored to each investigation's findings. Commands use actual resource names, namespaces, and values from your cluster, so they're ready to copy and execute.
How Commands Are Generated
Commands are derived from the investigation's root cause analysis:
- The AI identifies what needs to change based on the root cause
- Commands are constructed using actual resource names and namespaces from the topology
- Commands are validated for correctness (proper syntax, valid resource references)
Example Commands
Pod Recovery
# Restart a deployment after an OOM crash
kubectl rollout restart deployment/api-gateway -n production
# Check rollout status
kubectl rollout status deployment/api-gateway -n production
Resource Adjustment
# Increase memory limit (note: only memory and CPU requests are set, never a CPU limit)
kubectl set resources deployment/api-gateway -n production \
--limits=memory=512Mi --requests=cpu=200m,memory=256Mi
# Scale up replicas
kubectl scale deployment/api-gateway -n production --replicas=3
CPU limit policy
By product policy, generated commands never set a CPU limit. Setting a CPU limit causes CPU throttling that is usually counterproductive, so OpsWorker sets CPU and memory requests and a memory limit instead (and may recommend removing an existing CPU limit). You will not see a --limits=cpu=... in any generated command.
Debugging
# View recent logs from the affected pod
kubectl logs deployment/api-gateway -n production --tail=100
# Check events in the namespace
kubectl get events -n production --sort-by='.lastTimestamp' | tail -20
# Describe the affected pod for detailed status
kubectl describe pod api-gateway-7d8f9b6c4-x2k9p -n production
Where Commands Appear
- Slack messages: copy-paste ready from the investigation notification
- Portal: in the investigation detail recommendations section
- Chat: ask "Give me the commands to fix this" for a focused list
Safety
Commands are suggestions only. OpsWorker never executes commands on your cluster:
- Commands are displayed for human review
- Engineers decide whether and when to execute them
- The Kubernetes Agent operates in read-only mode
See Safe Execution Model for details.
Next Steps
- Safe Execution Model: OpsWorker's safety guarantees
- Suggested Fixes: how recommendations are structured