{
  "id": "cks-psa-namespace",
  "title": "Pod Security Admission",
  "category": "Cluster Security",
  "difficulty": "Easy",
  "type": "task",
  "weight": 4,
  "description": "## Pod Security Admission (PSA)\n\nPod Security Admission replaced PodSecurityPolicies (PSP) to enforce security standards at the namespace level.\n\n**Your task:**\n\nA namespace named `secure-workloads` already exists. Add the necessary label to this namespace to **enforce** the `restricted` pod security standard.\n\n```bash\n# Verify your label:\nkubectl get ns secure-workloads --show-labels\n```",
  "hints": [
    {
      "title": "Namespace Label",
      "body": "Label the namespace with the `pod-security.kubernetes.io/enforce=restricted` key-value pair.",
      "command": "kubectl label ns secure-workloads pod-security.kubernetes.io/enforce=restricted"
    }
  ],
  "setup_commands": [
    {
      "command": "kubectl create namespace secure-workloads --dry-run=client -o yaml | kubectl apply -f -"
    }
  ],
  "validation": {
    "commands": [
      {
        "description": "Namespace secure-workloads is labeled",
        "command": "kubectl get ns secure-workloads -o jsonpath='{.metadata.labels.pod-security\\.kubernetes\\.io/enforce}'",
        "expected_output": "restricted",
        "match": "exact"
      }
    ]
  },
  "default_namespace": "default",
  "teardown_commands": [
    {
      "command": "kubectl delete namespace secure-workloads --ignore-not-found --wait=false"
    }
  ]
}
