मुख्य सामग्री पर जाएँ
Skillpedia
डिप्लॉय और क्लाउड (DevOps)35k · #8067

implementing-kubernetes-pod-security-standards

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

यह टूल Kubernetes पर चल रहे आपके ऐप्स के लिए सिक्योरिटी नियम तय करने और लागू करने में मदद करता है। यह तीन स्तरों में से चुनने देता है: 'Privileged' (कोई रोक नहीं), 'Baseline' (ज्ञात खतरों को रोकता है) और 'Restricted' (सबसे सुरक्षित, जिसमें कई पाबंदियां हैं)। इससे ऐप्स सुरक्षा की अच्छी आदतों का पालन करते हैं।

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

  • ✓किसी ऐप्स के समूह (namespace) पर कौन सा सुरक्षा स्तर लागू करना है, यह तय करते समय।
  • ✓यह देखने के लिए कि सख्त नियम लागू करने पर कौन से ऐप्स में समस्या आ सकती है।
  • ✓पुराने सुरक्षा नियमों को नए नियमों में बदलने की योजना बनाते समय।

Skill का लिंक

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

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

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

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

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

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

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

“किसी ऐप को 'Restricted' प्रोफ़ाइल के साथ चलाने के लिए मुझे उसमें क्या बदलाव करने होंगे?”

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

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

यह टूल 'Pod Security Standards' (PSS) नाम की सेटिंग्स का इस्तेमाल करता है, जो ऐप्स के समूहों (namespaces) पर लागू होती हैं। ये सेटिंग्स तय करती हैं कि ऐप्स के चलने के लिए क्या अनुमति है और क्या मना है, ताकि उनके पास ज़रूरत से ज़्यादा अधिकार न हों और कोई ज्ञात कमजोरी न रहे।

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

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

Implementing Kubernetes Pod Security Standards

Overview

Pod Security Standards (PSS) define three levels of security policies -- Privileged, Baseline, and Restricted -- enforced by the Pod Security Admission (PSA) controller built into Kubernetes 1.25+. PSA replaces the deprecated PodSecurityPolicy and provides namespace-level enforcement with three modes: enforce, audit, and warn.

When to Use

  • Deciding whether a namespace or workload belongs at Privileged, Baseline, or Restricted
  • Auditing which existing workloads would be rejected if Restricted were enforced today
  • Translating a "must meet Restricted" requirement into concrete securityContext changes
  • Planning a PodSecurityPolicy migration and predicting what will break before it does
  • Mapping pod security posture to a compliance control (NIST PR.PS-01, CIS Kubernetes)

Not this skill: configuring the controller that enforces these profiles — namespace labels, AdmissionConfiguration, exemptions, or debugging a pod PSA rejected. Use implementing-pod-security-admission-controller.

Prerequisites

  • Kubernetes cluster 1.25+ (PSA GA)
  • kubectl configured with cluster-admin access
  • Understanding of Linux capabilities and security contexts

Core Concepts

Three Security Profiles

Profile Purpose Restrictions
Privileged Unrestricted, system workloads None
Baseline Prevents known escalations No hostNetwork, hostPID, hostIPC, privileged containers, dangerous capabilities
Restricted Hardened best practices Non-root, drop ALL caps, seccomp required, read-only rootfs recommended

Three Enforcement Modes

Mode Behavior
enforce Rejects pods that violate the policy
audit Logs violations in audit log but allows pod
warn Returns warning to user but allows pod

Workflow

Step 1: Label Namespaces for PSA

# Restricted namespace - production workloads
apiVersion: v1
kind: Namespace
metadata:
  name: production
  labels:
    pod-security.kubernetes.io/enforce: restricted
    pod-security.kubernetes.io/enforce-version: latest
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/audit-version: latest
    pod-security.kubernetes.io/warn: restricted
    pod-security.kubernetes.io/warn-version: latest
# Baseline namespace - general workloads
apiVersion: v1
kind: Namespace
metadata:
  name: staging
  labels:
    pod-security.kubernetes.io/enforce: baseline
    pod-security.kubernetes.io/enforce-version: latest
    pod-security.kubernetes.io/audit: restricted
    pod-security.kubernetes.io/audit-version: latest
    pod-security.kubernetes.io/warn: restricted
    pod-security.kubernetes.io/warn-version: latest
# Privileged namespace - system components only
apiVersion: v1
kind: Namespace
metadata:
  name: kube-system
  labels:
    pod-security.kubernetes.io/enforce: privileged
    pod-security.kubernetes.io/enforce-version: latest

Step 2: Apply Labels to Existing Namespaces

# Apply restricted enforcement to production
kubectl label namespace production \
  pod-security.kubernetes.io/enforce=restricted \
  pod-security.kubernetes.io/audit=restricted \
  pod-security.kubernetes.io/warn=restricted \
  --overwrite

# Apply baseline to staging with restricted warnings
kubectl label namespace staging \
  pod-security.kubernetes.io/enforce=baseline \
  pod-security.kubernetes.io/audit=restricted \
  pod-security.kubernetes.io/warn=restricted \
  --overwrite

# Check labels on all namespaces
kubectl get namespaces -L pod-security.kubernetes.io/enforce

Step 3: Create Compliant Pod Specs

# Restricted-compliant deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: secure-app
  namespace: production
spec:
  replicas: 3
  selector:
    matchLabels:
      app: secure-app
  template:
    metadata:
      labels:
        app: secure-app
    spec:
      automountServiceAccountToken: false
      securityContext:
        runAsNonRoot: true
        runAsUser: 65534
        runAsGroup: 65534
        fsGroup: 65534
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: app
          image: myregistry.com/myapp:v1.0.0@sha256:abc123
          ports:
            - containerPort: 8080
              protocol: TCP
          securityContext:
            allowPrivilegeEscalation: false

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

Privileged, Baseline और Restricted प्रोफ़ाइल क्या हैं?

Privileged पर कोई रोक नहीं होती। Baseline ऐप्स को ज्ञात सुरक्षा समस्याएं पैदा करने से रोकता है। Restricted सबसे सुरक्षित है, जिसमें ऐप्स को बिना extra privileges के और ज़्यादा सुरक्षित कॉन्फ़िगरेशन के साथ चलना होता है।

मुझे कैसे पता चलेगा कि मेरा ऐप नए नियमों के साथ काम करेगा?

नियम लागू करने से पहले आप उन्हें 'audit' या 'warn' मोड में टेस्ट कर सकते हैं। इससे आप देख पाते हैं कि कौन से ऐप्स नियम तोड़ेंगे, बिना उन्हें रोके, ताकि आपके पास उन्हें ठीक करने का समय हो।

'securityContext' क्या है?

यह Kubernetes की एक सेटिंग है जो चल रहे ऐप के लिए सुरक्षा अनुमतियां और विशेषताएं तय करती है, जैसे वह एडमिनिस्ट्रेटर के रूप में चल सकता है या नहीं, वह कौन सी system capabilities इस्तेमाल कर सकता है, आदि।

जानकारी

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

Chooses and applies the correct Kubernetes Pod Security Standard (Privileged, Baseline, Restricted) for a workload: what each profile forbids, how to map existing workloads to a profile, which securityContext fields must change, and how to plan a PodSecurityPolicy-to-PSS migration without breaking running pods. Use when deciding which pod security profile a namespace or workload should run under,

repo: mukul975/Anthropic-Cybersecurity-Skills

लोकप्रियता

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

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

0

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

कमेंट

  • …

इस repository की और skills

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