用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/rossoctl/rossoctl --skill k8s-pods命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
AI-assisted documentation review for Rossoctl PRs — structure, accuracy, links, conciseness
Deploy and manage Rossoctl operator, agents, and tools on Kubernetes. Handles installer, CRDs, pipelines, and demo deployments.
Deploy and manage Rossoctl platform, operator, agents, and tools on Kubernetes.
基于 SOC 职业分类
正在显示 SKILL.md
| name | k8s:pods |
| description | Debug and troubleshoot pod issues including crashes, failures, networking, and resource problems |
This skill provides systematic approaches to debugging pod issues in the Rossoctl platform.
All kubectl/oc commands MUST redirect output to files. Commands below are shown in bare form for readability. When executing, always redirect:
export LOG_DIR=/tmp/rossoctl/k8s/${CLUSTER:-local}
mkdir -p $LOG_DIR
# Pattern for all kubectl commands:
kubectl <command> > $LOG_DIR/<descriptive-name>.log 2>&1 && echo "OK" || echo "FAIL (see $LOG_DIR/<descriptive-name>.log)"
# Analyze in subagent: Task(subagent_type='Explore') to read log files
# Use subagents for BOTH failure analysis AND verifying expected behavior
rossoctl:deploy to verify pods are healthy# All pods with status
kubectl get pods -A -o wide
# Only problematic pods
kubectl get pods -A | grep -vE "Running|Completed"
# Pods sorted by restarts
kubectl get pods -A --sort-by='.status.containerStatuses[0].restartCount' | tail -20
# Pods with high restart count
kubectl get pods -A | awk '$4 > 3 {print $0}'
# Recent pod events
kubectl get events -A --sort-by='.lastTimestamp' | tail -30
Pod is running normally. Check if app inside is working correctly.
# Check why pod is pending
kubectl describe pod <pod-name> -n <namespace>
# Common causes:
# - Insufficient CPU/memory on nodes
# - Unbound PersistentVolumeClaim
# - Node selector not matching any nodes
# - Image pull in progress
# Check node resources
kubectl top nodes
kubectl describe nodes
# Check logs before crash
kubectl logs -n <namespace> <pod-name> --previous
# Check current logs
kubectl logs -n <namespace> <pod-name>
# Check pod events
kubectl describe pod -n <namespace> <pod-name>
# Common causes:
# - Application error on startup
# - Missing configuration/secrets
# - Failed liveness probe
# - Dependency not available
# Check pod events for exact error
kubectl describe pod -n <namespace> <pod-name>
# Check if image exists in registry
docker pull <image-name>
# For Kind cluster, load image manually
kind load docker-image <image-name> --name agent-platform
# Check if image is in Kind cluster
docker exec agent-platform-control-plane crictl images | grep <image-name>
# Common causes:
# - Image doesn't exist
# - Wrong image tag
# - No access to registry (auth)
# - Network issues
# Check exit code and reason
kubectl describe pod -n <namespace> <pod-name> | grep -A5 "State:"
# Check logs
kubectl logs -n <namespace> <pod-name> --previous
# Common exit codes:
# 0 - Success
# 1 - General error
# 137 - SIGKILL (OOM killed)
# 143 - SIGTERM (terminated)
# Check for OOM in events
kubectl get events -A | grep -i "OOMKilled"
# Check pod memory limits
kubectl describe pod -n <namespace> <pod-name> | grep -A10 "Limits:"
# Check actual memory usage
kubectl top pod -n <namespace> <pod-name>
# Fix: Increase memory limits
kubectl edit deployment -n <namespace> <deployment-name>
# Increase resources.limits.memory and resources.requests.memory
# Get pod status
kubectl get pod -n <namespace> <pod-name>
# Get full pod description
kubectl describe pod -n <namespace> <pod-name>
# Check pod YAML
kubectl get pod -n <namespace> <pod-name> -o yaml
# Check pod events
kubectl get events -n <namespace> --field-selector involvedObject.name=<pod-name>
# Current logs
kubectl logs -n <namespace> <pod-name>
# Previous logs (if crashed)
kubectl logs -n <namespace> <pod-name> --previous
# All containers (including sidecars)
kubectl logs -n <namespace> <pod-name> --all-containers=true
# Specific container
kubectl logs -n <namespace> <pod-name> -c <container-name>
# Follow logs
kubectl logs -n <namespace> <pod-name> -f --tail=20
# Check resource usage
kubectl top pod -n <namespace> <pod-name>
# Check resource limits
kubectl describe pod -n <namespace> <pod-name> | grep -A10 "Limits:"
kubectl describe pod -n <namespace> <pod-name> | grep -A10 "Requests:"
# Check node resources
kubectl top nodes
# Check environment variables
kubectl describe pod -n <namespace> <pod-name> | grep -A20 "Environment:"
# Check mounted secrets
kubectl describe pod -n <namespace> <pod-name> | grep -A10 "Mounts:"
# Verify secret exists
kubectl get secret -n <namespace> <secret-name>
# Check configmap
kubectl get configmap -n <namespace> <configmap-name>
# Check service endpoints
kubectl get endpoints -n <namespace> <service-name>
# Check if pod is in service
kubectl get endpoints -n <namespace> <service-name> -o yaml
# Test connectivity FROM the pod
kubectl exec -n <namespace> <pod-name> -- curl -I http://<service-name>
# Test connectivity TO the pod
kubectl run debug-curl --image=curlimages/curl --rm -it -- \
curl http://<pod-ip>:<port>
# Check network policies
kubectl get networkpolicy -n <namespace>
# Check deployment
kubectl get deployment -n team1 weather-tool
kubectl describe deployment -n team1 weather-tool
# Check pods
kubectl get pods -n team1 -l app=weather-tool
# Check service endpoints
kubectl get endpoints -n team1 weather-tool
# Test MCP endpoint (weather-tool)
kubectl exec -n team1 deployment/weather-tool -- \
curl -I http://localhost:8000/health || echo "Health check failed"
# Check for API errors (weather service)
kubectl logs -n team1 deployment/weather-service | grep -iE "api|error|openai"
# Check if Keycloak is deployment or statefulset
kubectl get deployment -n keycloak keycloak 2>/dev/null || kubectl get statefulset -n keycloak keycloak
# Check pod status
kubectl get pods -n keycloak -l app=keycloak
# Check readiness
kubectl exec -n keycloak deployment/keycloak -c keycloak -- \
curl -sf http://localhost:8080/health/ready || echo "Not ready"
# Check PostgreSQL dependency
kubectl get pods -n keycloak -l app=postgresql
kubectl logs -n keycloak deployment/postgresql --tail=50 2>/dev/null
# Common issues:
# - PostgreSQL not ready
# - Database connection failures
# - Memory limits too low (increase to 1Gi)
# Check operator deployment
kubectl get deployment -n rossoctl-system -l control-plane=controller-manager
# Check operator pods
kubectl get pods -n rossoctl-system -l control-plane=controller-manager
# Check operator logs for errors
kubectl logs -n rossoctl-system -l control-plane=controller-manager | \
grep -iE "error|fail"
# Check Component CRD processing
kubectl get components -A
kubectl describe component -n <namespace> <component-name>
# Check if operator is reconciling
kubectl logs -n rossoctl-system -l control-plane=controller-manager --tail=50 | \
grep -i "reconcile"
# Check if sidecar is injected
kubectl get pod -n <namespace> <pod-name> -o jsonpath='{.spec.containers[*].name}'
# Should show: <app-container> istio-proxy
# Check sidecar status
kubectl get pod -n <namespace> <pod-name> -o jsonpath='{.status.containerStatuses[?(@.name=="istio-proxy")].ready}'
# Should show: true
# Check sidecar logs
kubectl logs -n <namespace> <pod-name> -c istio-proxy
# Common issues:
# - Sidecar not injected (check namespace label)
# - mTLS errors (check certificates)
# - Connection failures (check virtual services)
# Get shell access
kubectl exec -n <namespace> <pod-name> -it -- /bin/sh
# or
kubectl exec -n <namespace> <pod-name> -it -- /bin/bash
# Run specific command
kubectl exec -n <namespace> <pod-name> -- ls -la /app
kubectl exec -n <namespace> <pod-name> -- env
kubectl exec -n <namespace> <pod-name> -- cat /etc/resolv.conf
# Test network connectivity
kubectl exec -n <namespace> <pod-name> -- ping <service-name>
kubectl exec -n <namespace> <pod-name> -- curl http://<service-name>:<port>
kubectl exec -n <namespace> <pod-name> -- nslookup <service-name>
# Create debug pod in same namespace
kubectl run debug-pod -n <namespace> --image=busybox --rm -it -- sh
# Test network connectivity
kubectl run debug-curl -n <namespace> --image=curlimages/curl --rm -it -- \
curl -v http://<service-name>:<port>
# Test DNS resolution
kubectl run debug-dns -n <namespace> --image=busybox --rm -it -- \
nslookup <service-name>
# Check pod-to-pod connectivity
kubectl run debug-net -n <namespace> --image=nicolaka/netshoot --rm -it -- \
curl http://<pod-ip>:<port>
# Delete pod (deployment will recreate)
kubectl delete pod -n <namespace> <pod-name>
# Restart deployment (all pods)
kubectl rollout restart deployment -n <namespace> <deployment-name>
# Scale to zero and back (forces recreation)
kubectl scale deployment -n <namespace> <deployment-name> --replicas=0
kubectl scale deployment -n <namespace> <deployment-name> --replicas=1
# Update deployment to force new pods
kubectl patch deployment -n <namespace> <deployment-name> \
-p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"kubectl.kubernetes.io/restartedAt\":\"$(date +%Y-%m-%dT%H:%M:%S)\"}}}}}"
# Check rollout status
kubectl rollout status deployment -n <namespace> <deployment-name>
# Check deployment history
kubectl rollout history deployment -n <namespace> <deployment-name>
# Rollback to previous version
kubectl rollout undo deployment -n <namespace> <deployment-name>
# Rollback to specific revision
kubectl rollout undo deployment -n <namespace> <deployment-name> --to-revision=2
# Edit deployment
kubectl edit deployment -n <namespace> <deployment-name>
# Find resources section and update:
# resources:
# requests:
# memory: "256Mi"
# cpu: "100m"
# limits:
# memory: "512Mi"
# cpu: "500m"
# Or patch directly
kubectl patch deployment -n <namespace> <deployment-name> -p \
'{"spec":{"template":{"spec":{"containers":[{"name":"<container-name>","resources":{"limits":{"memory":"1Gi"}}}]}}}}'
Cause: Insufficient resources
Fix:
kubectl top nodes
kubectl describe nodes
# Scale down other pods or add resources to Kind cluster
Cause: Application startup failure
Fix:
kubectl logs -n <namespace> <pod-name> --previous
# Fix configuration, secrets, or application code
# Redeploy
Cause: Image not available
Fix:
# Load image into Kind
kind load docker-image <image-name> --name agent-platform
# Or fix image name in deployment
kubectl edit deployment -n <namespace> <deployment-name>
Cause: Pods not matching service selector
Fix:
# Check service selector
kubectl get svc -n <namespace> <service-name> -o yaml | grep -A5 selector
# Check pod labels
kubectl get pods -n <namespace> --show-labels
# Fix labels in deployment
kubectl edit deployment -n <namespace> <deployment-name>
Cause: Network policy or DNS issues
Fix:
# Test DNS
kubectl exec -n <namespace> <pod-name> -- nslookup <service-name>
# Test connectivity
kubectl exec -n <namespace> <pod-name> -- curl http://<service-name>:<port>
# Check network policies
kubectl get networkpolicy -n <namespace>
kubectl describe networkpolicy -n <namespace> <policy-name>
kubectl describe pod shows most common issues--previous is essential