Rulepython
Kubernetes Rule
paths:
Kubernetes Operations Rules
When interacting with the Kubernetes cluster:
Environment
Always use explicit kubeconfig:
KUBECONFIG=/home/al/.kube/config kubectl <command>
Safe Operations
These are safe and can be run freely:
kubectl get- Read resourceskubectl describe- Resource detailskubectl logs- Container logskubectl top- Resource usage
Modifying Operations
Use caution with:
kubectl apply- Apply manifestskubectl delete- Remove resourceskubectl rollout restart- Restart deploymentskubectl scale- Change replica count
Dangerous Operations
Avoid unless explicitly requested:
kubectl delete namespace- Deletes all resourceskubectl delete --all- Bulk deletion- Force deletion with
--force --grace-period=0
Debugging
For pod issues:
# Check events
kubectl get events -n <namespace> --sort-by='.lastTimestamp'
# Check logs
kubectl logs <pod> -n <namespace> --tail=50
# Previous container logs
kubectl logs <pod> -n <namespace> --previous
# Exec into pod
kubectl exec -it <pod> -n <namespace> -- /bin/bash
Common Namespaces
ai-agents- AI monitoring agentsvllm- LLM inferencetemporal- Workflow orchestrationflux-system- GitOpscert-manager- TLS certificates