[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7E4TXKEH2F030FPD2ARB3TF":3,"skill-same:01M7E4TXKEH2F030FPD2ARB3TF":102},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M7E4TXKEH2F030FPD2ARB3TF","implementing-opa-gatekeeper-for-policy-enforcement",null,"Deploys OPA Gatekeeper via Helm as a Kubernetes admission controller and writes ConstraintTemplates with Rego plus instantiated Constraints to validate, mutate, or deny resource requests at admission time. Use when enforcing custom policy-as-code at admission on Kubernetes v1.24+, blocking non-compliant workloads before scheduling, or expressing a rule that built-in controls cannot. Keywords: Gatekeeper, ConstraintTemplate, Constraint, Rego, admission webhook, audit, mutation. Do not use for the standard pod security profiles that Pod Security Admission already covers - use implementing-pod-security-admission-controller.","sanjeevafk\u002Fagent-skills","sanjeevafk","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F230678117?v=4","01M7C540EFY46ETG1NNWKS5X3Q","Sanjeev","01M7C540F366J5C1D587BMKH9Q",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: implementing-opa-gatekeeper-for-policy-enforcement\ndescription: >-\n  Deploys OPA Gatekeeper via Helm as a Kubernetes admission controller and writes\n  ConstraintTemplates with Rego plus instantiated Constraints to validate, mutate, or deny\n  resource requests at admission time. Use when enforcing custom policy-as-code at admission\n  on Kubernetes v1.24+, blocking non-compliant workloads before scheduling, or expressing a\n  rule that built-in controls cannot. Keywords: Gatekeeper, ConstraintTemplate, Constraint,\n  Rego, admission webhook, audit, mutation. Do not use for the standard pod security profiles\n  that Pod Security Admission already covers - use\n  implementing-pod-security-admission-controller.\ndomain: cybersecurity\nsubdomain: container-security\ntags:\n- opa\n- gatekeeper\n- kubernetes\n- admission-control\n- policy-as-code\n- rego\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\n- PR.IR-01\n- ID.AM-08\n- DE.CM-01\nmitre_attack:\n- T1610\n- T1611\n- T1609\n- T1525\n---\n\n# Implementing OPA Gatekeeper for Policy Enforcement\n\n## Overview\n\nOPA Gatekeeper is a Kubernetes admission controller that enforces policies written in Rego. It uses ConstraintTemplates (policy blueprints with Rego logic) and Constraints (instantiated policies with parameters) to validate, mutate, or deny Kubernetes resource requests at admission time.\n\n\n## When to Use\n\n- When deploying or configuring implementing opa gatekeeper for policy enforcement capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- Kubernetes cluster v1.24+\n- Helm 3\n- kubectl with cluster-admin access\n- Familiarity with Rego policy language\n\n## Installing Gatekeeper\n\n```bash\n# Install via Helm\nhelm repo add gatekeeper https:\u002F\u002Fopen-policy-agent.github.io\u002Fgatekeeper\u002Fcharts\nhelm repo update\n\nhelm install gatekeeper gatekeeper\u002Fgatekeeper \\\n  --namespace gatekeeper-system --create-namespace \\\n  --set replicas=3 \\\n  --set audit.replicas=1 \\\n  --set audit.logLevel=INFO\n\n# Verify\nkubectl get pods -n gatekeeper-system\nkubectl get crd | grep gatekeeper\n```\n\n### Verify Installation\n\n```bash\n# Check webhook\nkubectl get validatingwebhookconfigurations gatekeeper-validating-webhook-configuration\n\n# Check CRDs\nkubectl get crd constrainttemplates.templates.gatekeeper.sh\nkubectl get crd configs.config.gatekeeper.sh\n```\n\n## ConstraintTemplate Examples\n\n### 1. Require Labels on Resources\n\n```yaml\n# template-required-labels.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8srequiredlabels\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sRequiredLabels\n      validation:\n        openAPIV3Schema:\n          type: object\n          properties:\n            labels:\n              type: array\n              items:\n                type: string\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8srequiredlabels\n\n        violation[{\"msg\": msg, \"details\": {\"missing_labels\": missing}}] {\n          provided := {label | input.review.object.metadata.labels[label]}\n          required := {label | label := input.parameters.labels[_]}\n          missing := required - provided\n          count(missing) > 0\n          msg := sprintf(\"Missing required labels: %v\", [missing])\n        }\n```\n\n```yaml\n# constraint-require-team-label.yaml\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sRequiredLabels\nmetadata:\n  name: require-team-label\nspec:\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Namespace\"]\n      - apiGroups: [\"apps\"]\n        kinds: [\"Deployment\"]\n  parameters:\n    labels:\n      - \"team\"\n      - \"environment\"\n```\n\n### 2. Block Privileged Containers\n\n```yaml\n# template-block-privileged.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8sblockprivileged\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sBlockPrivileged\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8sblockprivileged\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          container.securityContext.privileged == true\n          msg := sprintf(\"Privileged container not allowed: %v\", [container.name])\n        }\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.initContainers[_]\n          container.securityContext.privileged == true\n          msg := sprintf(\"Privileged init container not allowed: %v\", [container.name])\n        }\n```\n\n```yaml\n# constraint-block-privileged.yaml\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sBlockPrivileged\nmetadata:\n  name: block-privileged-containers\nspec:\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Pod\"]\n    namespaces:\n      - \"production\"\n      - \"staging\"\n```\n\n### 3. Restrict Container Image Registries\n\n```yaml\n# template-allowed-repos.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8sallowedrepos\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sAllowedRepos\n      validation:\n        openAPIV3Schema:\n          type: object\n          properties:\n            repos:\n              type: array\n              items:\n                type: string\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8sallowedrepos\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not image_matches(container.image)\n          msg := sprintf(\"Container image %v is not from an allowed registry. Allowed: %v\", [container.image, input.parameters.repos])\n        }\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.initContainers[_]\n          not image_matches(container.image)\n          msg := sprintf(\"Init container image %v is not from an allowed registry. Allowed: %v\", [container.image, input.parameters.repos])\n        }\n\n        image_matches(image) {\n          repo := input.parameters.repos[_]\n          startswith(image, repo)\n        }\n```\n\n```yaml\n# constraint-allowed-repos.yaml\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sAllowedRepos\nmetadata:\n  name: restrict-image-repos\nspec:\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Pod\"]\n  parameters:\n    repos:\n      - \"gcr.io\u002Fmy-project\u002F\"\n      - \"ghcr.io\u002Fmy-org\u002F\"\n      - \"registry.k8s.io\u002F\"\n```\n\n### 4. Enforce Resource Limits\n\n```yaml\n# template-require-limits.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8srequirelimits\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sRequireLimits\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8srequirelimits\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not container.resources.limits.cpu\n          msg := sprintf(\"Container %v has no CPU limit\", [container.name])\n        }\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not container.resources.limits.memory\n          msg := sprintf(\"Container %v has no memory limit\", [container.name])\n        }\n```\n\n### 5. Block Latest Image Tag\n\n```yaml\n# template-block-latest-tag.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8sblocklatesttag\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sBlockLatestTag\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8sblocklatesttag\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          endswith(container.image, \":latest\")\n          msg := sprintf(\"Container %v uses ':latest' tag. Use specific version tags.\", [container.name])\n        }\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not contains(container.image, \":\")\n          msg := sprintf(\"Container %v has no tag (defaults to latest). Use specific version tags.\", [container.name])\n        }\n```\n\n### 6. Enforce Read-Only Root Filesystem\n\n```yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8sreadonlyroot\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sReadOnlyRoot\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8sreadonlyroot\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not container.securityContext.readOnlyRootFilesystem\n          msg := sprintf(\"Container %v must have readOnlyRootFilesystem set to true\", [container.name])\n        }\n```\n\n## Audit and Enforcement Modes\n\n```yaml\n# Dry-run mode (audit only, don't block)\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sBlockPrivileged\nmetadata:\n  name: block-privileged-dryrun\nspec:\n  enforcementAction: dryrun   # dryrun | deny | warn\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Pod\"]\n```\n\n### Check Audit Violations\n\n```bash\n# List all constraint violations\nkubectl get k8sblockprivileged block-privileged-containers -o yaml | grep -A 20 violations\n\n# Check all constraints audit status\nkubectl get constraints -o json | jq '.items[] | {name: .metadata.name, violations: (.status.violations \u002F\u002F [] | length)}'\n```\n\n## Gatekeeper Config (Exempt Namespaces)\n\n```yaml\napiVersion: config.gatekeeper.sh\u002Fv1alpha1\nkind: Config\nmetadata:\n  name: config\n  namespace: gatekeeper-system\nspec:\n  match:\n    - excludedNamespaces:\n        - kube-system\n        - gatekeeper-system\n        - calico-system\n      processes:\n        - \"*\"\n```\n\n## Monitoring\n\n```bash\n# Check Gatekeeper metrics\nkubectl port-forward -n gatekeeper-system svc\u002Fgatekeeper-webhook-service 8443:443\n\n# Prometheus metrics\nkubectl get --raw \u002Fmetrics | grep gatekeeper\n```\n\n## Best Practices\n\n1. **Start with dryrun** - Deploy constraints in `dryrun` mode first, review violations, then switch to `deny`\n2. **Use the policy library** - Leverage https:\u002F\u002Fgithub.com\u002Fopen-policy-agent\u002Fgatekeeper-library for pre-built templates\n3. **Exempt system namespaces** - Always exclude kube-system and gatekeeper-system\n4. **Version control policies** - Store ConstraintTemplates and Constraints in Git\n5. **Monitor audit results** - Check constraint `.status.violations` regularly\n6. **Test Rego policies** - Use `opa test` or Rego Playground before deploying\n7. **Combine with admission webhooks** - Layer Gatekeeper with Pod Security Admission for defense in depth\n","# Implementing OPA Gatekeeper for Policy Enforcement\n\n## Overview\n\nOPA Gatekeeper is a Kubernetes admission controller that enforces policies written in Rego. It uses ConstraintTemplates (policy blueprints with Rego logic) and Constraints (instantiated policies with parameters) to validate, mutate, or deny Kubernetes resource requests at admission time.\n\n\n## When to Use\n\n- When deploying or configuring implementing opa gatekeeper for policy enforcement capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- Kubernetes cluster v1.24+\n- Helm 3\n- kubectl with cluster-admin access\n- Familiarity with Rego policy language\n\n## Installing Gatekeeper\n\n```bash\n# Install via Helm\nhelm repo add gatekeeper https:\u002F\u002Fopen-policy-agent.github.io\u002Fgatekeeper\u002Fcharts\nhelm repo update\n\nhelm install gatekeeper gatekeeper\u002Fgatekeeper \\\n  --namespace gatekeeper-system --create-namespace \\\n  --set replicas=3 \\\n  --set audit.replicas=1 \\\n  --set audit.logLevel=INFO\n\n# Verify\nkubectl get pods -n gatekeeper-system\nkubectl get crd | grep gatekeeper\n```\n\n### Verify Installation\n\n```bash\n# Check webhook\nkubectl get validatingwebhookconfigurations gatekeeper-validating-webhook-configuration\n\n# Check CRDs\nkubectl get crd constrainttemplates.templates.gatekeeper.sh\nkubectl get crd configs.config.gatekeeper.sh\n```\n\n## ConstraintTemplate Examples\n\n### 1. Require Labels on Resources\n\n```yaml\n# template-required-labels.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8srequiredlabels\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sRequiredLabels\n      validation:\n        openAPIV3Schema:\n          type: object\n          properties:\n            labels:\n              type: array\n              items:\n                type: string\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8srequiredlabels\n\n        violation[{\"msg\": msg, \"details\": {\"missing_labels\": missing}}] {\n          provided := {label | input.review.object.metadata.labels[label]}\n          required := {label | label := input.parameters.labels[_]}\n          missing := required - provided\n          count(missing) > 0\n          msg := sprintf(\"Missing required labels: %v\", [missing])\n        }\n```\n\n```yaml\n# constraint-require-team-label.yaml\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sRequiredLabels\nmetadata:\n  name: require-team-label\nspec:\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Namespace\"]\n      - apiGroups: [\"apps\"]\n        kinds: [\"Deployment\"]\n  parameters:\n    labels:\n      - \"team\"\n      - \"environment\"\n```\n\n### 2. Block Privileged Containers\n\n```yaml\n# template-block-privileged.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8sblockprivileged\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sBlockPrivileged\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8sblockprivileged\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          container.securityContext.privileged == true\n          msg := sprintf(\"Privileged container not allowed: %v\", [container.name])\n        }\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.initContainers[_]\n          container.securityContext.privileged == true\n          msg := sprintf(\"Privileged init container not allowed: %v\", [container.name])\n        }\n```\n\n```yaml\n# constraint-block-privileged.yaml\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sBlockPrivileged\nmetadata:\n  name: block-privileged-containers\nspec:\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Pod\"]\n    namespaces:\n      - \"production\"\n      - \"staging\"\n```\n\n### 3. Restrict Container Image Registries\n\n```yaml\n# template-allowed-repos.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8sallowedrepos\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sAllowedRepos\n      validation:\n        openAPIV3Schema:\n          type: object\n          properties:\n            repos:\n              type: array\n              items:\n                type: string\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8sallowedrepos\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not image_matches(container.image)\n          msg := sprintf(\"Container image %v is not from an allowed registry. Allowed: %v\", [container.image, input.parameters.repos])\n        }\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.initContainers[_]\n          not image_matches(container.image)\n          msg := sprintf(\"Init container image %v is not from an allowed registry. Allowed: %v\", [container.image, input.parameters.repos])\n        }\n\n        image_matches(image) {\n          repo := input.parameters.repos[_]\n          startswith(image, repo)\n        }\n```\n\n```yaml\n# constraint-allowed-repos.yaml\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sAllowedRepos\nmetadata:\n  name: restrict-image-repos\nspec:\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Pod\"]\n  parameters:\n    repos:\n      - \"gcr.io\u002Fmy-project\u002F\"\n      - \"ghcr.io\u002Fmy-org\u002F\"\n      - \"registry.k8s.io\u002F\"\n```\n\n### 4. Enforce Resource Limits\n\n```yaml\n# template-require-limits.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8srequirelimits\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sRequireLimits\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8srequirelimits\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not container.resources.limits.cpu\n          msg := sprintf(\"Container %v has no CPU limit\", [container.name])\n        }\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not container.resources.limits.memory\n          msg := sprintf(\"Container %v has no memory limit\", [container.name])\n        }\n```\n\n### 5. Block Latest Image Tag\n\n```yaml\n# template-block-latest-tag.yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8sblocklatesttag\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sBlockLatestTag\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8sblocklatesttag\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          endswith(container.image, \":latest\")\n          msg := sprintf(\"Container %v uses ':latest' tag. Use specific version tags.\", [container.name])\n        }\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not contains(container.image, \":\")\n          msg := sprintf(\"Container %v has no tag (defaults to latest). Use specific version tags.\", [container.name])\n        }\n```\n\n### 6. Enforce Read-Only Root Filesystem\n\n```yaml\napiVersion: templates.gatekeeper.sh\u002Fv1\nkind: ConstraintTemplate\nmetadata:\n  name: k8sreadonlyroot\nspec:\n  crd:\n    spec:\n      names:\n        kind: K8sReadOnlyRoot\n  targets:\n    - target: admission.k8s.gatekeeper.sh\n      rego: |\n        package k8sreadonlyroot\n\n        violation[{\"msg\": msg}] {\n          container := input.review.object.spec.containers[_]\n          not container.securityContext.readOnlyRootFilesystem\n          msg := sprintf(\"Container %v must have readOnlyRootFilesystem set to true\", [container.name])\n        }\n```\n\n## Audit and Enforcement Modes\n\n```yaml\n# Dry-run mode (audit only, don't block)\napiVersion: constraints.gatekeeper.sh\u002Fv1beta1\nkind: K8sBlockPrivileged\nmetadata:\n  name: block-privileged-dryrun\nspec:\n  enforcementAction: dryrun   # dryrun | deny | warn\n  match:\n    kinds:\n      - apiGroups: [\"\"]\n        kinds: [\"Pod\"]\n```\n\n### Check Audit Violations\n\n```bash\n# List all constraint violations\nkubectl get k8sblockprivileged block-privileged-containers -o yaml | grep -A 20 violations\n\n# Check all constraints audit status\nkubectl get constraints -o json | jq '.items[] | {name: .metadata.name, violations: (.status.violations \u002F\u002F [] | length)}'\n```\n\n## Gatekeeper Config (Exempt Namespaces)\n\n```yaml\napiVersion: config.gatekeeper.sh\u002Fv1alpha1\nkind: Config\nmetadata:\n  name: config\n  namespace: gatekeeper-system\nspec:\n  match:\n    - excludedNamespaces:\n        - kube-system\n        - gatekeeper-system\n        - calico-system\n      processes:\n        - \"*\"\n```\n\n## Monitoring\n\n```bash\n# Check Gatekeeper metrics\nkubectl port-forward -n gatekeeper-system svc\u002Fgatekeeper-webhook-service 8443:443\n\n# Prometheus metrics\nkubectl get --raw \u002Fmetrics | grep gatekeeper\n```\n\n## Best Practices\n\n1. **Start with dryrun** - Deploy constraints in `dryrun` mode first, review violations, then switch to `deny`\n2. **Use the policy library** - Leverage https:\u002F\u002Fgithub.com\u002Fopen-policy-agent\u002Fgatekeeper-library for pre-built templates\n3. **Exempt system namespaces** - Always exclude kube-system and gatekeeper-system\n4. **Version control policies** - Store ConstraintTemplates and Constraints in Git\n5. **Monitor audit results** - Check constraint `.status.violations` regularly\n6. **Test Rego policies** - Use `opa test` or Rego Playground before deploying\n7. **Combine with admission webhooks** - Layer Gatekeeper with Pod Security Admission for defense in depth\n",{"name":5,"tags":25,"author":32,"domain":33,"license":15,"version":34,"nist_csf":35,"subdomain":40,"description":7,"mitre_attack":41},[26,27,28,29,30,31],"opa","gatekeeper","kubernetes","admission-control","policy-as-code","rego","mahipal","cybersecurity","1.0",[36,37,38,39],"PR.PS-01","PR.IR-01","ID.AM-08","DE.CM-01","container-security",[42,43,44,45],"T1610","T1611","T1609","T1525","main","4e084e84eb42fc53e144c89c0f7f48b39c8a4b0f","collections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement",1,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills","https:\u002F\u002Fgithub.com\u002Fsanjeevafk","First make it work. Then make it right. Then make it fast.","2026-11-14 13:36:16",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add sanjeevafk\u002Fagent-skills --skill implementing-opa-gatekeeper-for-policy-enforcement",{"tool":60,"command":61},"bunx","bunx skills add sanjeevafk\u002Fagent-skills --skill implementing-opa-gatekeeper-for-policy-enforcement",{"tool":63,"command":64},"pnpm","pnpm dlx skills add sanjeevafk\u002Fagent-skills --skill implementing-opa-gatekeeper-for-policy-enforcement","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002FSKILL.md",true,[68,74,78,84,88,92,98],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"assets\u002Ftemplate.md","ASSET","资产文件",1445,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002Fassets\u002Ftemplate.md",{"path":75,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fapi-reference.md","REFERENCE","参考文档",1134,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002Freferences\u002Fapi-reference.md",{"path":85,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fstandards.md",2129,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002Freferences\u002Fstandards.md",{"path":89,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fworkflows.md",2767,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002Freferences\u002Fworkflows.md",{"path":93,"resourceType":94,"resourceTypeDesc":95,"sizeBytes":96,"sourceHtmlUrl":97},"scripts\u002Fagent.py","SCRIPT","脚本",4292,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002Fscripts\u002Fagent.py",{"path":99,"resourceType":94,"resourceTypeDesc":95,"sizeBytes":100,"sourceHtmlUrl":101},"scripts\u002Fprocess.py",6805,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fimplementing-opa-gatekeeper-for-policy-enforcement\u002Fscripts\u002Fprocess.py",[103,111,119,127,135,142],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":20},"01M7EFHX67M3KKXT1BXVPA5ADT","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","MIT","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":115,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":20},"01M7EFFQGM51TZBGRENXY50ZYM","whiteboard-diagrams","Create accurate, simple, hand-drawn whiteboard diagrams from a user's process, system, architecture, learning workflow, comparison, or causal explanation. Use when the user asks for a scribbly whiteboard visual, educational workflow graphic, hand-drawn explainer, or diagram like the bundled reference; ask one focused clarification question when the subject or relationships are missing, then generate and visually verify the final image.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FSKILL.md",[],[],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":123,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":20},"01M7EFF1CSQNTDMHFK4ZGY6NYK","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":131,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":20},"01M7EFE8106X6C28FT8PA74427","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":20},"01M7EFCSNZM9G7ZHS6F127Q71X","verification-loop","A comprehensive verification system for Claude Code sessions.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":146,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":20},"01M7EFCE7EZMKPRYDDNKBQ9EEH","vercel-deploy","Deploy applications and websites to Vercel. Use when the user requests deployment actions like \"deploy my app\", \"deploy and give me the link\", \"push this live\", or \"create a preview deployment\".","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FSKILL.md",[],[]]