{
  "id": "exec-command-basics",
  "title": "Execute Commands in Pods",
  "category": "Troubleshooting",
  "difficulty": "Easy",
  "type": "task",
  "weight": 3,
  "description": "## Execute Commands in Pods\n\nSometimes you need to run arbitrary commands inside a running container to debug or change state.\n\n**Your task:**\n\nA pod named `worker-pod` is running. Use `kubectl exec` to create an empty file at `/tmp/ready` inside the container.\n\n```bash\n# Verify the file was created:\nkubectl exec worker-pod -- ls /tmp/ready\n```",
  "hints": [
    {
      "title": "Use kubectl exec",
      "body": "You can pass commands to the container by adding `--` after the pod name.",
      "command": "kubectl exec worker-pod -- touch /tmp/ready"
    }
  ],
  "setup_commands": [
    {
      "command": "kubectl run worker-pod --image=busybox:1.36 --command -- sleep 3600"
    },
    {
      "command": "kubectl wait --for=condition=Ready pod/worker-pod --timeout=30s"
    }
  ],
  "validation": {
    "commands": [
      {
        "description": "File /tmp/ready exists inside worker-pod",
        "command": "kubectl exec worker-pod -- ls /tmp/ready 2>/dev/null",
        "expected_output": "/tmp/ready",
        "match": "contains"
      }
    ]
  },
  "default_namespace": "default",
  "teardown_commands": [
    {
      "command": "kubectl delete pod worker-pod --ignore-not-found --grace-period=0 --force"
    }
  ]
}
