Admission Review — request/response for admission webhooks.
1apiVersion: admission.k8s.io/v12kind: AdmissionReview3request:4 uid: 12345-abcde5 kind:6 group: ""7 kind: Pod8 version: v19 resource:10 group: ""11 resource: pods12 version: v113 name: my-pod14 namespace: production15 operation: CREATE16 userInfo:17 username: system:serviceaccount:production:myapp18 uid: 12345-abcde19 object:20 apiVersion: v121 kind: Pod22 metadata:23 name: my-pod24 namespace: production25 spec:26 containers:27 - name: app28 image: nginx:latest29response:30 uid: 12345-abcde31 allowed: true32 status:33 message: "Pod created successfully"34 patchType: JSONPatch35 patch: W3sib3AiOiAiYWRkIiwgInBhdGgiOiAiL21ldGFkYXRhL2xhYmVscyIsICJ2YWx1ZSI6IHsiYXBwIjogIm5naW54In19XQ==36---37# Mutating webhook response with patches38response:39 uid: 12345-abcde40 allowed: true41 patchType: JSONPatch42 patch: W3sib3AiOiAiYWRkIiwgInBhdGgiOiAiL21ldGFkYXRhL2xhYmVscyIsICJ2YWx1ZSI6IHsiYXBwIjogIm5naW54In19XQ==43---44# Validating webhook response (deny)45response:46 uid: 12345-abcde47 allowed: false48 status:49 code: 40350 message: "Pod does not meet security requirements"51 reason: Forbidden
1# Check webhook logs for AdmissionReview2kubectl logs -n kube-system -l app=webhook-server | grep AdmissionReview34# View webhook audit events5kubectl get events --field-selector reason=FailedCreate --sort-by=.lastTimestamp67# Check webhook configuration8kubectl get validatingwebhookconfigurations -o yaml | grep -A 20 admissionReviewVersions910# Test webhook response11kubectl apply -f pod.yaml 2>&1 | grep -i "admission webhook"
Request Fields:
Response Fields: