kubernetes-hardening – skill DevOps & Hạ tầng cho agent AI
Triển khai security context, Pod Security Standards và network policy cho Kubernetes.
Cài skill kubernetes-hardening bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/kubernetes-hardening-bb495.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /kubernetes-hardening – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/kubernetes-hardening-bb495.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $kubernetes-hardening – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/kubernetes-hardening-bb495.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /kubernetes-hardening – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/kubernetes-hardening-bb495.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /kubernetes-hardening – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Kubernetes Hardening
Secure Kubernetes clusters and workloads.
When to Use This Skill
Use this skill when:
- Hardening Kubernetes clusters
- Implementing Pod Security Standards
- Configuring network policies
- Meeting security compliance
Scope and validation
Confirm the exact cluster/namespace/version and authorized writes before applying policies. Examples are fragments: validate the reviewed image, namespace, service accounts, labels and required runtime storage. Pin the policy version to the target Kubernetes release where supported. Restricted admission controls new/updated pods; it does not retroactively fix running workloads or establish compliance.
Pod Security Standards
# Namespace with restricted policy
apiVersion: v1
kind: Namespace
metadata:
name: production
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/warn: restrictedSecurity Context
apiVersion: v1
kind: Pod
metadata:
name: secure-pod
labels:
app: web
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: app
image: registry.example.invalid/myapp:REVIEWED_IMMUTABLE_TAG
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]Network Policies
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
spec:
podSelector: {}
policyTypes:
- Ingress
- Egress
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-web
spec:
podSelector:
matchLabels:
app: web
ingress:
- from:
- podSelector:
matchLabels:
app: frontend
ports:
- port: 8080RBAC
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: app-reader
rules:
- apiGroups: [""]
resources: ["pods", "services"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: app-reader-binding
subjects:
- kind: ServiceAccount
name: myapp
roleRef:
kind: Role
name: app-reader
apiGroup: rbac.authorization.k8s.ioBest Practices
- Enable Pod Security Standards
- Implement network policies
- Use RBAC with least privilege
- Enable audit logging
- Secure etcd with encryption
- Use service mesh for mTLS
- Regular security scanning
Related Skills
- kubernetes-ops (
kubernetes-ops) - K8s operations - container-hardening (
container-hardening) - Container security
Limitations
- Apply guidance only within authorized scope; test destructive steps in non-production first.
- Docs-only import: upstream scripts and templates not bundled.
Example
# Read-only first: inventory before any active step.
which <tool> && <tool> --help | head -n 20> Adapted from [BagelHole/DevOps-Security-Agent-Skills](https://github.com/BagelHole/DevOps-Security-Agent-Skills) (MIT); frontmatter, When to Use/Limitations, and safety boundaries added for upstream compliance. Docs-only import: helper scripts and templates not bundled.
NetworkPolicy enforcement requires a supporting CNI. The default-deny example also blocks DNS and dependencies until narrowly scoped rules are added; same-namespace pod selectors do not authorize arbitrary namespaces. Test allowed and denied flows from the real source identities and preserve recovery access. readOnlyRootFilesystem may require bounded writable temporary volumes; do not disable it blindly after a startup error. [Kubernetes NetworkPolicy behavior](https://kubernetes.io/docs/concepts/services-networking/network-policies/).
Skill liên quan
- kubernetes-ops – Triển khai, mở rộng và quản lý khối lượng công việc Kubernetes.
- kustomize – Tùy chỉnh manifest Kubernetes mà không cần templating bằng Kustomize.
- langfuse – Chuyên gia về Langfuse - nền tảng observability LLM mã nguồn mở. Bao gồm tracing, quản…
- linux-administration – Quản trị hệ thống cho máy chủ Linux. Quản lý gói phần mềm, dịch vụ và cấu hình hệ thống…
- linux-hardening – Áp dụng benchmark CIS và bảo mật máy chủ Linux.
- linux-privilege-escalation – Thực hiện đánh giá leo thang đặc quyền có hệ thống trên Linux để tìm và khai thác cấu…
- linux-shell-scripting – Cung cấp mẫu shell script sẵn sàng cho môi trường production cho các tác vụ quản trị…
- linux-troubleshooting – Quy trình xử lý sự cố Linux để chẩn đoán và khắc phục lỗi hệ thống, vấn đề hiệu năng và…