मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी35k · #8097

implementing-pod-security-admission-controller

यह क्या करती है

यह फीचर Kubernetes Pod Security Admission (PSA) controller को कॉन्फ़िगर और मैनेज करने में मदद करता है। यह तय परिभाषित मानकों का पालन करके आपके एप्लिकेशन को सुरक्षित तरीके से चलाने में मदद करता है।

कब इस्तेमाल करें

  • ✓जब Kubernetes cluster पर पहली बार pod security सेट करना हो।
  • ✓पूरे cluster के लिए डिफ़ॉल्ट सिक्योरिटी नियम सेट करने हों।
  • ✓यह जांचने के लिए कि कोई pod क्यों ब्लॉक हुआ या सिक्योरिटी उम्मीद के मुताबिक क्यों काम नहीं कर रही।

Skill का लिंक

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-pod-security-admission-controller/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-pod-security-admission-controller/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“'production' namespace के लिए 'restricted' सिक्योरिटी लेवल कैसे सेट करूँ?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

आप namespaces पर खास labels लगाकर सिक्योरिटी नियम तय करते हैं, या पूरे cluster के लिए एक central फाइल कॉन्फ़िगर करते हैं। इससे Kubernetes को पता चलता है कि हर namespace को कौन से सिक्योरिटी मानक फॉलो करने हैं।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Implementing Pod Security Admission Controller

Overview

Pod Security Admission (PSA) is a built-in Kubernetes admission controller (stable since v1.25) that enforces Pod Security Standards at the namespace level. It replaces the deprecated PodSecurityPolicy (PSP) and provides three security profiles: Privileged, Baseline, and Restricted, with three enforcement modes: enforce, audit, and warn.

When to Use

  • Wiring PSA up on a cluster for the first time
  • Setting cluster-wide default enforcement via AdmissionConfiguration
  • Exempting system namespaces, service accounts, or runtime classes from enforcement
  • Debugging why a pod was rejected, or why enforcement is silently not firing
  • Staging a safe rollout: warn and audit first, enforce once violations reach zero
  • Pulling PSA violations out of the kube-apiserver audit log

Not this skill: deciding which profile a workload should run under, or what securityContext changes Restricted demands. Use implementing-kubernetes-pod-security-standards.

Prerequisites

  • Kubernetes v1.25+ (PSA is stable/GA)
  • kubectl with cluster-admin access
  • No dependency on external tools - PSA is built into kube-apiserver

Pod Security Standards

Privileged Profile

  • Unrestricted - No restrictions applied
  • Use case: System-level pods (kube-system, monitoring)

Baseline Profile

  • Minimally restrictive - Prevents known privilege escalation
  • Blocks: privileged containers, hostPID, hostIPC, hostNetwork, hostPorts, certain volume types, adding capabilities beyond runtime defaults

Restricted Profile

  • Heavily restricted - Follows security best practices
  • Requires: non-root, drop ALL capabilities, seccomp RuntimeDefault, read-only root filesystem considerations
  • Blocks: Everything in Baseline plus running as root, privilege escalation, non-approved volume types

Enforcement Modes

Mode Behavior Use Case
enforce Reject pods violating policy Production enforcement
audit Log violations to audit log Pre-enforcement assessment
warn Show warnings to user Developer feedback

Implementation

Apply to Namespace via Labels

# Restricted enforcement with audit and warn
apiVersion: v1
kind: Namespace
metadata:
  name: production
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: v1.28
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/audit-version: v1.28
    pod-security.kubernetes.io/warn: restricted
    pod-security.kubernetes.io/warn-version: v1.28
# Baseline enforcement for staging
apiVersion: v1
kind: Namespace
metadata:
  name: staging
  labels:
    pod-security.kubernetes.io/enforce: baseline
    pod-security.kubernetes.io/enforce-version: v1.28
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/audit-version: v1.28
    pod-security.kubernetes.io/warn: restricted
    pod-security.kubernetes.io/warn-version: v1.28
# Privileged for system namespaces
apiVersion: v1
kind: Namespace
metadata:
  name: kube-system
  labels:
    pod-security.kubernetes.io/enforce: privileged

Apply Labels with kubectl

# Set restricted enforcement
kubectl label namespace production \
  pod-security.kubernetes.io/enforce=restricted \
  pod-security.kubernetes.io/enforce-version=v1.28 \
  pod-security.kubernetes.io/audit=restricted \
  pod-security.kubernetes.io/warn=restricted

# Set baseline enforcement
kubectl label namespace staging \
  pod-security.kubernetes.io/enforce=baseline \
  pod-security.kubernetes.io/audit=restricted \
  pod-security.kubernetes.io/warn=restricted

# Check current labels
kubectl get namespace production -o jsonpath='{.metadata.labels}' | jq .

Dry-Run Testing

# Test what would happen with restricted policy on a namespace
kubectl label --dry-run=server --overwrite namespace staging \
  pod-security.kubernetes.io/enforce=restricted

# Output shows existing pods that would violate the policy
# Warning: existing pods in namespace "staging" violate the new PodSecurity enforce level "restricted:latest"

Cluster-Wide Defaults (AdmissionConfiguration)

# /etc/kubernetes/psa-config.yaml
apiVersion: apiserver.config.k8s.io/v1
kind: AdmissionConfiguration
plugins:
  - name: PodSecurity
    configuration:
      apiVersion: pod-security.admission.config.k8s.io/v1

…
अक्सर पूछे जाने वाले सवाल

कौन से सिक्योरिटी लेवल उपलब्ध हैं?

तीन लेवल हैं: 'Privileged' (कोई पाबंदी नहीं), 'Baseline' (न्यूनतम सख्त) और 'Restricted' (बहुत सख्त, best practices पर आधारित)।

enforcement modes क्या हैं?

मोड ये हैं: 'enforce' (नियम तोड़ने वाले pods को ब्लॉक करता है), 'audit' (उल्लंघनों को log करता है) और 'warn' (यूज़र को उल्लंघन की चेतावनी देता है)।

क्या कुछ अलग से install करना पड़ता है?

नहीं, Pod Security Admission (PSA) controller नए Kubernetes वर्ज़न (v1.25+) में पहले से built-in है।

जानकारी

लेखक का मूल विवरण

Configures and operates the Kubernetes Pod Security Admission (PSA) controller that enforces Pod Security Standards: namespace enforce/audit/warn labels, cluster-wide defaults via AdmissionConfiguration, exemptions for usernames, runtime classes and namespaces, version pinning, and troubleshooting pods the controller rejected. Use when wiring PSA up on a cluster, setting cluster-wide default enfor

repo: mukul975/Anthropic-Cybersecurity-Skills

लोकप्रियता

GitHub स्टार
35k
रैंकिंग में स्थान
#8097
लाइसेंस
Apache-2.0
अपडेट की गई
31/8/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills