[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EWC2C8N3Z7YYHWPRWR2938":3,"skill-same:01M6EWC2C8N3Z7YYHWPRWR2938":111},{"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":6,"sourceHtmlUrl":16,"categories":17,"keywords":29,"publishedAt":50,"linkOnly":51,"markdownContent":52,"markdownBody":53,"frontMatter":54,"refName":72,"commitSha":73,"skillDirectory":74,"forksCount":14,"repositoryHtmlUrl":75,"repositoryHomepageUrl":76,"ownerHtmlUrl":77,"ownerBlogUrl":6,"ownerDescription":78,"updatedAt":79,"install":80,"resources":93},"01M6EWC2C8N3Z7YYHWPRWR2938","securing-kubernetes-on-cloud",null,"This skill covers hardening managed Kubernetes clusters on EKS, AKS, and GKE by implementing Pod Security Standards, network policies, workload identity, RBAC scoping, image admission controls, and runtime security monitoring. It addresses cloud-specific security features including IRSA for EKS, Workload Identity for GKE, and Managed Identities for AKS.","henriquescastilho\u002Fmy-claude","henriquescastilho","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F153296945?v=4","01M6ESH7EXPXTH9CVQ4K16SRG8","Henrique Scheer","01M6ESH7JHEK2PTNNH4HEH787Z",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002FSKILL.md",[18,23,26],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49],"kubernetes","securing kubernetes on cloud","cloud","security standards","image","de","cm","pod-security-standards","security-standards","t1078","aks","gke","eks","network","cloud-security","monitoring","rbac","workload","cybersecurity","security","2026-11-10 10:12:30",false,"---\nname: securing-kubernetes-on-cloud\ndescription: 'This skill covers hardening managed Kubernetes clusters on EKS, AKS,\n  and GKE by implementing Pod Security Standards, network policies, workload identity,\n  RBAC scoping, image admission controls, and runtime security monitoring. It addresses\n  cloud-specific security features including IRSA for EKS, Workload Identity for GKE,\n  and Managed Identities for AKS.\n\n  '\ndomain: cybersecurity\nsubdomain: cloud-security\ntags:\n- kubernetes-security\n- eks\n- aks\n- gke\n- pod-security-standards\n- container-runtime\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.IR-01\n- ID.AM-08\n- GV.SC-06\n- DE.CM-01\nmitre_attack:\n- T1078.004\n- T1530\n- T1537\n- T1580\n- T1610\n---\n\n# Securing Kubernetes on Cloud\n\n## When to Use\n\n- When deploying new managed Kubernetes clusters in production with security requirements\n- When hardening existing EKS, AKS, or GKE clusters after a security audit or pentest finding\n- When implementing workload identity to eliminate static cloud credentials in pods\n- When enforcing pod security policies across namespaces to prevent container escapes\n- When integrating runtime security monitoring for detecting container-level threats\n\n**Do not use** for non-Kubernetes container deployments like ECS Fargate or Azure Container Instances, for application-level security within containers (see securing-serverless-functions), or for CI\u002FCD pipeline security (see implementing-cloud-devsecops).\n\n## Prerequisites\n\n- Managed Kubernetes cluster provisioned on EKS, AKS, or GKE with admin access\n- kubectl configured with cluster admin credentials\n- Familiarity with Kubernetes RBAC, namespaces, and security contexts\n- Container network interface plugin supporting network policies (Calico, Cilium)\n\n## Workflow\n\n### Step 1: Enforce Pod Security Standards\n\nApply Pod Security Admission labels at the namespace level to enforce the Restricted profile in production namespaces. Pod Security Policies were removed in Kubernetes v1.25 and replaced with Pod Security Admission.\n\n```yaml\n# Production namespace with restricted Pod Security Standard\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    pod-security.kubernetes.io\u002Fenforce: restricted\n    pod-security.kubernetes.io\u002Fenforce-version: latest\n    pod-security.kubernetes.io\u002Faudit: restricted\n    pod-security.kubernetes.io\u002Fwarn: restricted\n---\n# Staging namespace with baseline enforcement\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: staging\n  labels:\n    pod-security.kubernetes.io\u002Fenforce: baseline\n    pod-security.kubernetes.io\u002Faudit: restricted\n    pod-security.kubernetes.io\u002Fwarn: restricted\n```\n\n```yaml\n# Pod spec compliant with restricted profile\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secure-app\n  namespace: production\nspec:\n  automountServiceAccountToken: false\n  securityContext:\n    runAsNonRoot: true\n    runAsUser: 1000\n    fsGroup: 1000\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n    - name: app\n      image: company\u002Fapp:v2.1@sha256:abc123...\n      securityContext:\n        allowPrivilegeEscalation: false\n        readOnlyRootFilesystem: true\n        capabilities:\n          drop: [\"ALL\"]\n      resources:\n        limits:\n          cpu: \"500m\"\n          memory: \"256Mi\"\n        requests:\n          cpu: \"100m\"\n          memory: \"128Mi\"\n```\n\n### Step 2: Configure Cloud-Native Workload Identity\n\nEliminate static cloud credentials in pods by binding Kubernetes service accounts to cloud IAM roles.\n\n```bash\n# EKS: IAM Roles for Service Accounts (IRSA)\neksctl create iamserviceaccount \\\n  --cluster production-cluster \\\n  --namespace production \\\n  --name web-app-sa \\\n  --attach-policy-arn arn:aws:iam::123456789012:policy\u002FWebAppS3ReadOnly \\\n  --approve\n\n# GKE: Workload Identity\ngcloud iam service-accounts create web-app-sa \\\n  --project=my-gcp-project\n\ngcloud iam service-accounts add-iam-policy-binding \\\n  web-app-sa@my-gcp-project.iam.gserviceaccount.com \\\n  --role roles\u002Fstorage.objectViewer \\\n  --member \"serviceAccount:my-gcp-project.svc.id.goog[production\u002Fweb-app-sa]\"\n\nkubectl annotate serviceaccount web-app-sa \\\n  --namespace production \\\n  iam.gke.io\u002Fgcp-service-account=web-app-sa@my-gcp-project.iam.gserviceaccount.com\n\n# AKS: Azure AD Workload Identity\naz identity create --name web-app-identity --resource-group production-rg\naz identity federated-credential create \\\n  --name web-app-federation \\\n  --identity-name web-app-identity \\\n  --resource-group production-rg \\\n  --issuer \"$(az aks show -n production-cluster -g production-rg --query oidcIssuerProfile.issuerUrl -o tsv)\" \\\n  --subject system:serviceaccount:production:web-app-sa\n```\n\n### Step 3: Implement Network Policies\n\nDeploy network policies to restrict pod-to-pod communication following the principle of least privilege. By default, Kubernetes allows all pods to communicate with each other.\n\n```yaml\n# Default deny all ingress and egress in production namespace\napiVersion: networking.k8s.io\u002Fv1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\n  namespace: production\nspec:\n  podSelector: {}\n  policyTypes:\n    - Ingress\n    - Egress\n---\n# Allow web-app to receive traffic from ingress controller only\napiVersion: networking.k8s.io\u002Fv1\nkind: NetworkPolicy\nmetadata:\n  name: allow-ingress-to-web\n  namespace: production\nspec:\n  podSelector:\n    matchLabels:\n      app: web-app\n  policyTypes:\n    - Ingress\n  ingress:\n    - from:\n        - namespaceSelector:\n            matchLabels:\n              name: ingress-nginx\n      ports:\n        - protocol: TCP\n          port: 8080\n---\n# Allow web-app to connect to database only\napiVersion: networking.k8s.io\u002Fv1\nkind: NetworkPolicy\nmetadata:\n  name: allow-web-to-db\n  namespace: production\nspec:\n  podSelector:\n    matchLabels:\n      app: web-app\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - podSelector:\n            matchLabels:\n              app: postgres\n      ports:\n        - protocol: TCP\n          port: 5432\n    - to:\n        - namespaceSelector: {}\n          podSelector:\n            matchLabels:\n              k8s-app: kube-dns\n      ports:\n        - protocol: UDP\n          port: 53\n```\n\n### Step 4: Configure RBAC with Least Privilege\n\nScope Kubernetes RBAC roles to specific namespaces and resources. Avoid ClusterRoleBindings for non-administrative users.\n\n```yaml\n# Developer role scoped to specific namespace\napiVersion: rbac.authorization.k8s.io\u002Fv1\nkind: Role\nmetadata:\n  name: developer-role\n  namespace: staging\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"pods\", \"pods\u002Flog\", \"services\", \"configmaps\"]\n    verbs: [\"get\", \"list\", \"watch\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments\"]\n    verbs: [\"get\", \"list\", \"watch\", \"update\", \"patch\"]\n  # Explicitly deny secrets access\n---\napiVersion: rbac.authorization.k8s.io\u002Fv1\nkind: RoleBinding\nmetadata:\n  name: developer-binding\n  namespace: staging\nsubjects:\n  - kind: Group\n    name: developers\n    apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: Role\n  name: developer-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n### Step 5: Deploy Image Admission Controls\n\nUse admission controllers to enforce that only signed images from trusted registries are deployed. Implement OPA\u002FGatekeeper or Kyverno for policy enforcement.\n\n```yaml\n# Kyverno policy: require images from approved registries\napiVersion: kyverno.io\u002Fv1\nkind: ClusterPolicy\nmetadata:\n  name: restrict-image-registries\nspec:\n  validationFailureAction: Enforce\n  rules:\n    - name: validate-registries\n      match:\n        any:\n          - resources:\n              kinds: [\"Pod\"]\n      validate:\n        message: \"Images must come from approved registries\"\n        pattern:\n          spec:\n            containers:\n              - image: \"123456789012.dkr.ecr.us-east-1.amazonaws.com\u002F* | gcr.io\u002Fmy-gcp-project\u002F*\"\n---\n# Kyverno policy: require image digest (no mutable tags)\napiVersion: kyverno.io\u002Fv1\nkind: ClusterPolicy\nmetadata:\n  name: require-image-digest\nspec:\n  validationFailureAction: Enforce\n  rules:\n    - name: require-digest\n      match:\n        any:\n          - resources:\n              kinds: [\"Pod\"]\n      validate:\n        message: \"Images must use digest references, not tags\"\n        pattern:\n          spec:\n            containers:\n              - image: \"*@sha256:*\"\n```\n\n### Step 6: Enable Runtime Security Monitoring\n\nDeploy runtime security tools to detect anomalous behavior inside containers including process execution, file system modifications, and network connections.\n\n```bash\n# Deploy Falco for runtime threat detection\nhelm repo add falcosecurity https:\u002F\u002Ffalcosecurity.github.io\u002Fcharts\nhelm install falco falcosecurity\u002Ffalco \\\n  --namespace falco-system --create-namespace \\\n  --set falcosidekick.enabled=true \\\n  --set falcosidekick.config.slack.webhookurl=\"https:\u002F\u002Fhooks.slack.com\u002Fservices\u002Fxxx\"\n\n# Run kube-bench for CIS Kubernetes Benchmark assessment\nkubectl apply -f https:\u002F\u002Fraw.githubusercontent.com\u002Faquasecurity\u002Fkube-bench\u002Fmain\u002Fjob-eks.yaml\nkubectl logs -l app=kube-bench\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Pod Security Standards | Three profiles (Privileged, Baseline, Restricted) enforced via Pod Security Admission that control pod security context capabilities |\n| Workload Identity | Cloud-native mechanism binding Kubernetes service accounts to cloud IAM roles for credential-free cloud API access (IRSA, GKE WI, AKS MI) |\n| Network Policy | Kubernetes resource defining allowed ingress and egress traffic flows between pods, enforced by the CNI plugin |\n| Admission Controller | Kubernetes plugin that intercepts API requests before persistence to validate or mutate resources against security policies |\n| RBAC | Role-Based Access Control in Kubernetes, defining what actions (verbs) identities can perform on which resources in which namespaces |\n| Seccomp Profile | Linux kernel feature restricting the system calls a container process can make, reducing the kernel attack surface |\n| Service Mesh | Infrastructure layer (Istio, Linkerd) providing mutual TLS, traffic policies, and observability for service-to-service communication |\n\n## Tools & Systems\n\n- **Falco**: Open-source runtime security engine detecting anomalous behavior in containers using kernel-level system call monitoring\n- **Kyverno**: Kubernetes-native policy engine for admission control, mutation, and generation of resources based on security policies\n- **kube-bench**: CIS Kubernetes Benchmark assessment tool checking cluster configuration against security best practices\n- **Trivy**: Vulnerability scanner for container images, file systems, and Kubernetes resources with SBOM generation\n- **Calico\u002FCilium**: CNI plugins providing network policy enforcement and advanced network security features including eBPF-based monitoring\n\n## Common Scenarios\n\n### Scenario: Cryptominer Deployed via Compromised Container Image\n\n**Context**: GuardDuty Extended Threat Detection generates an AttackSequence:EKS\u002FCompromisedCluster finding. A developer pulled a public Docker image containing an embedded XMRig cryptominer that executes at container startup.\n\n**Approach**:\n1. Isolate the affected pod by applying a deny-all network policy targeting its labels\n2. Capture the container image digest and scan it with Trivy to identify the embedded binary\n3. Review Kubernetes audit logs to identify who deployed the compromised image and when\n4. Deploy Kyverno ClusterPolicy requiring images from approved private registries only\n5. Enable image digest pinning to prevent tag mutation attacks\n6. Deploy Falco with rules detecting crypto mining process signatures (\u002Fusr\u002Fbin\u002Fxmrig, stratum+tcp connections)\n\n**Pitfalls**: Deleting the pod before capturing the image digest and audit logs destroys forensic evidence. Blocking only the specific image tag allows the attacker to re-push with a different tag.\n\n## Output Format\n\n```\nKubernetes Security Assessment Report\n=======================================\nCluster: production-cluster (EKS 1.29)\nProvider: AWS (us-east-1)\nAssessment Date: 2025-02-23\nTool: kube-bench v0.8.0 + manual review\n\nCIS KUBERNETES BENCHMARK RESULTS:\n  Total Controls: 124\n  Passed: 98 (79%)\n  Failed: 18 (15%)\n  Warnings: 8 (6%)\n\nCRITICAL FINDINGS:\n  [K8S-001] 3 namespaces lack Pod Security Standards enforcement\n    Namespaces: monitoring, logging, default\n    Remediation: Apply restricted PSA labels\n\n  [K8S-002] Default service account tokens auto-mounted in 12 deployments\n    Risk: Credential theft if container is compromised\n    Remediation: Set automountServiceAccountToken: false\n\n  [K8S-003] No network policies in production namespace\n    Risk: Unrestricted lateral movement between all pods\n    Remediation: Deploy default-deny policy with explicit allow rules\n\nHIGH FINDINGS:\n  [K8S-004] 5 pods running as root with privileged security context\n  [K8S-005] Images deployed using mutable tags (:latest) in 8 deployments\n  [K8S-006] RBAC ClusterRoleBinding grants cluster-admin to developers group\n```\n","# Securing Kubernetes on Cloud\n\n## When to Use\n\n- When deploying new managed Kubernetes clusters in production with security requirements\n- When hardening existing EKS, AKS, or GKE clusters after a security audit or pentest finding\n- When implementing workload identity to eliminate static cloud credentials in pods\n- When enforcing pod security policies across namespaces to prevent container escapes\n- When integrating runtime security monitoring for detecting container-level threats\n\n**Do not use** for non-Kubernetes container deployments like ECS Fargate or Azure Container Instances, for application-level security within containers (see securing-serverless-functions), or for CI\u002FCD pipeline security (see implementing-cloud-devsecops).\n\n## Prerequisites\n\n- Managed Kubernetes cluster provisioned on EKS, AKS, or GKE with admin access\n- kubectl configured with cluster admin credentials\n- Familiarity with Kubernetes RBAC, namespaces, and security contexts\n- Container network interface plugin supporting network policies (Calico, Cilium)\n\n## Workflow\n\n### Step 1: Enforce Pod Security Standards\n\nApply Pod Security Admission labels at the namespace level to enforce the Restricted profile in production namespaces. Pod Security Policies were removed in Kubernetes v1.25 and replaced with Pod Security Admission.\n\n```yaml\n# Production namespace with restricted Pod Security Standard\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: production\n  labels:\n    pod-security.kubernetes.io\u002Fenforce: restricted\n    pod-security.kubernetes.io\u002Fenforce-version: latest\n    pod-security.kubernetes.io\u002Faudit: restricted\n    pod-security.kubernetes.io\u002Fwarn: restricted\n---\n# Staging namespace with baseline enforcement\napiVersion: v1\nkind: Namespace\nmetadata:\n  name: staging\n  labels:\n    pod-security.kubernetes.io\u002Fenforce: baseline\n    pod-security.kubernetes.io\u002Faudit: restricted\n    pod-security.kubernetes.io\u002Fwarn: restricted\n```\n\n```yaml\n# Pod spec compliant with restricted profile\napiVersion: v1\nkind: Pod\nmetadata:\n  name: secure-app\n  namespace: production\nspec:\n  automountServiceAccountToken: false\n  securityContext:\n    runAsNonRoot: true\n    runAsUser: 1000\n    fsGroup: 1000\n    seccompProfile:\n      type: RuntimeDefault\n  containers:\n    - name: app\n      image: company\u002Fapp:v2.1@sha256:abc123...\n      securityContext:\n        allowPrivilegeEscalation: false\n        readOnlyRootFilesystem: true\n        capabilities:\n          drop: [\"ALL\"]\n      resources:\n        limits:\n          cpu: \"500m\"\n          memory: \"256Mi\"\n        requests:\n          cpu: \"100m\"\n          memory: \"128Mi\"\n```\n\n### Step 2: Configure Cloud-Native Workload Identity\n\nEliminate static cloud credentials in pods by binding Kubernetes service accounts to cloud IAM roles.\n\n```bash\n# EKS: IAM Roles for Service Accounts (IRSA)\neksctl create iamserviceaccount \\\n  --cluster production-cluster \\\n  --namespace production \\\n  --name web-app-sa \\\n  --attach-policy-arn arn:aws:iam::123456789012:policy\u002FWebAppS3ReadOnly \\\n  --approve\n\n# GKE: Workload Identity\ngcloud iam service-accounts create web-app-sa \\\n  --project=my-gcp-project\n\ngcloud iam service-accounts add-iam-policy-binding \\\n  web-app-sa@my-gcp-project.iam.gserviceaccount.com \\\n  --role roles\u002Fstorage.objectViewer \\\n  --member \"serviceAccount:my-gcp-project.svc.id.goog[production\u002Fweb-app-sa]\"\n\nkubectl annotate serviceaccount web-app-sa \\\n  --namespace production \\\n  iam.gke.io\u002Fgcp-service-account=web-app-sa@my-gcp-project.iam.gserviceaccount.com\n\n# AKS: Azure AD Workload Identity\naz identity create --name web-app-identity --resource-group production-rg\naz identity federated-credential create \\\n  --name web-app-federation \\\n  --identity-name web-app-identity \\\n  --resource-group production-rg \\\n  --issuer \"$(az aks show -n production-cluster -g production-rg --query oidcIssuerProfile.issuerUrl -o tsv)\" \\\n  --subject system:serviceaccount:production:web-app-sa\n```\n\n### Step 3: Implement Network Policies\n\nDeploy network policies to restrict pod-to-pod communication following the principle of least privilege. By default, Kubernetes allows all pods to communicate with each other.\n\n```yaml\n# Default deny all ingress and egress in production namespace\napiVersion: networking.k8s.io\u002Fv1\nkind: NetworkPolicy\nmetadata:\n  name: default-deny-all\n  namespace: production\nspec:\n  podSelector: {}\n  policyTypes:\n    - Ingress\n    - Egress\n---\n# Allow web-app to receive traffic from ingress controller only\napiVersion: networking.k8s.io\u002Fv1\nkind: NetworkPolicy\nmetadata:\n  name: allow-ingress-to-web\n  namespace: production\nspec:\n  podSelector:\n    matchLabels:\n      app: web-app\n  policyTypes:\n    - Ingress\n  ingress:\n    - from:\n        - namespaceSelector:\n            matchLabels:\n              name: ingress-nginx\n      ports:\n        - protocol: TCP\n          port: 8080\n---\n# Allow web-app to connect to database only\napiVersion: networking.k8s.io\u002Fv1\nkind: NetworkPolicy\nmetadata:\n  name: allow-web-to-db\n  namespace: production\nspec:\n  podSelector:\n    matchLabels:\n      app: web-app\n  policyTypes:\n    - Egress\n  egress:\n    - to:\n        - podSelector:\n            matchLabels:\n              app: postgres\n      ports:\n        - protocol: TCP\n          port: 5432\n    - to:\n        - namespaceSelector: {}\n          podSelector:\n            matchLabels:\n              k8s-app: kube-dns\n      ports:\n        - protocol: UDP\n          port: 53\n```\n\n### Step 4: Configure RBAC with Least Privilege\n\nScope Kubernetes RBAC roles to specific namespaces and resources. Avoid ClusterRoleBindings for non-administrative users.\n\n```yaml\n# Developer role scoped to specific namespace\napiVersion: rbac.authorization.k8s.io\u002Fv1\nkind: Role\nmetadata:\n  name: developer-role\n  namespace: staging\nrules:\n  - apiGroups: [\"\"]\n    resources: [\"pods\", \"pods\u002Flog\", \"services\", \"configmaps\"]\n    verbs: [\"get\", \"list\", \"watch\"]\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments\"]\n    verbs: [\"get\", \"list\", \"watch\", \"update\", \"patch\"]\n  # Explicitly deny secrets access\n---\napiVersion: rbac.authorization.k8s.io\u002Fv1\nkind: RoleBinding\nmetadata:\n  name: developer-binding\n  namespace: staging\nsubjects:\n  - kind: Group\n    name: developers\n    apiGroup: rbac.authorization.k8s.io\nroleRef:\n  kind: Role\n  name: developer-role\n  apiGroup: rbac.authorization.k8s.io\n```\n\n### Step 5: Deploy Image Admission Controls\n\nUse admission controllers to enforce that only signed images from trusted registries are deployed. Implement OPA\u002FGatekeeper or Kyverno for policy enforcement.\n\n```yaml\n# Kyverno policy: require images from approved registries\napiVersion: kyverno.io\u002Fv1\nkind: ClusterPolicy\nmetadata:\n  name: restrict-image-registries\nspec:\n  validationFailureAction: Enforce\n  rules:\n    - name: validate-registries\n      match:\n        any:\n          - resources:\n              kinds: [\"Pod\"]\n      validate:\n        message: \"Images must come from approved registries\"\n        pattern:\n          spec:\n            containers:\n              - image: \"123456789012.dkr.ecr.us-east-1.amazonaws.com\u002F* | gcr.io\u002Fmy-gcp-project\u002F*\"\n---\n# Kyverno policy: require image digest (no mutable tags)\napiVersion: kyverno.io\u002Fv1\nkind: ClusterPolicy\nmetadata:\n  name: require-image-digest\nspec:\n  validationFailureAction: Enforce\n  rules:\n    - name: require-digest\n      match:\n        any:\n          - resources:\n              kinds: [\"Pod\"]\n      validate:\n        message: \"Images must use digest references, not tags\"\n        pattern:\n          spec:\n            containers:\n              - image: \"*@sha256:*\"\n```\n\n### Step 6: Enable Runtime Security Monitoring\n\nDeploy runtime security tools to detect anomalous behavior inside containers including process execution, file system modifications, and network connections.\n\n```bash\n# Deploy Falco for runtime threat detection\nhelm repo add falcosecurity https:\u002F\u002Ffalcosecurity.github.io\u002Fcharts\nhelm install falco falcosecurity\u002Ffalco \\\n  --namespace falco-system --create-namespace \\\n  --set falcosidekick.enabled=true \\\n  --set falcosidekick.config.slack.webhookurl=\"https:\u002F\u002Fhooks.slack.com\u002Fservices\u002Fxxx\"\n\n# Run kube-bench for CIS Kubernetes Benchmark assessment\nkubectl apply -f https:\u002F\u002Fraw.githubusercontent.com\u002Faquasecurity\u002Fkube-bench\u002Fmain\u002Fjob-eks.yaml\nkubectl logs -l app=kube-bench\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| Pod Security Standards | Three profiles (Privileged, Baseline, Restricted) enforced via Pod Security Admission that control pod security context capabilities |\n| Workload Identity | Cloud-native mechanism binding Kubernetes service accounts to cloud IAM roles for credential-free cloud API access (IRSA, GKE WI, AKS MI) |\n| Network Policy | Kubernetes resource defining allowed ingress and egress traffic flows between pods, enforced by the CNI plugin |\n| Admission Controller | Kubernetes plugin that intercepts API requests before persistence to validate or mutate resources against security policies |\n| RBAC | Role-Based Access Control in Kubernetes, defining what actions (verbs) identities can perform on which resources in which namespaces |\n| Seccomp Profile | Linux kernel feature restricting the system calls a container process can make, reducing the kernel attack surface |\n| Service Mesh | Infrastructure layer (Istio, Linkerd) providing mutual TLS, traffic policies, and observability for service-to-service communication |\n\n## Tools & Systems\n\n- **Falco**: Open-source runtime security engine detecting anomalous behavior in containers using kernel-level system call monitoring\n- **Kyverno**: Kubernetes-native policy engine for admission control, mutation, and generation of resources based on security policies\n- **kube-bench**: CIS Kubernetes Benchmark assessment tool checking cluster configuration against security best practices\n- **Trivy**: Vulnerability scanner for container images, file systems, and Kubernetes resources with SBOM generation\n- **Calico\u002FCilium**: CNI plugins providing network policy enforcement and advanced network security features including eBPF-based monitoring\n\n## Common Scenarios\n\n### Scenario: Cryptominer Deployed via Compromised Container Image\n\n**Context**: GuardDuty Extended Threat Detection generates an AttackSequence:EKS\u002FCompromisedCluster finding. A developer pulled a public Docker image containing an embedded XMRig cryptominer that executes at container startup.\n\n**Approach**:\n1. Isolate the affected pod by applying a deny-all network policy targeting its labels\n2. Capture the container image digest and scan it with Trivy to identify the embedded binary\n3. Review Kubernetes audit logs to identify who deployed the compromised image and when\n4. Deploy Kyverno ClusterPolicy requiring images from approved private registries only\n5. Enable image digest pinning to prevent tag mutation attacks\n6. Deploy Falco with rules detecting crypto mining process signatures (\u002Fusr\u002Fbin\u002Fxmrig, stratum+tcp connections)\n\n**Pitfalls**: Deleting the pod before capturing the image digest and audit logs destroys forensic evidence. Blocking only the specific image tag allows the attacker to re-push with a different tag.\n\n## Output Format\n\n```\nKubernetes Security Assessment Report\n=======================================\nCluster: production-cluster (EKS 1.29)\nProvider: AWS (us-east-1)\nAssessment Date: 2025-02-23\nTool: kube-bench v0.8.0 + manual review\n\nCIS KUBERNETES BENCHMARK RESULTS:\n  Total Controls: 124\n  Passed: 98 (79%)\n  Failed: 18 (15%)\n  Warnings: 8 (6%)\n\nCRITICAL FINDINGS:\n  [K8S-001] 3 namespaces lack Pod Security Standards enforcement\n    Namespaces: monitoring, logging, default\n    Remediation: Apply restricted PSA labels\n\n  [K8S-002] Default service account tokens auto-mounted in 12 deployments\n    Risk: Credential theft if container is compromised\n    Remediation: Set automountServiceAccountToken: false\n\n  [K8S-003] No network policies in production namespace\n    Risk: Unrestricted lateral movement between all pods\n    Remediation: Deploy default-deny policy with explicit allow rules\n\nHIGH FINDINGS:\n  [K8S-004] 5 pods running as root with privileged security context\n  [K8S-005] Images deployed using mutable tags (:latest) in 8 deployments\n  [K8S-006] RBAC ClusterRoleBinding grants cluster-admin to developers group\n```\n",{"name":5,"tags":55,"author":58,"domain":48,"license":15,"version":59,"nist_csf":60,"subdomain":44,"description":65,"mitre_attack":66},[56,42,40,41,37,57],"kubernetes-security","container-runtime","mahipal","1.0.0",[61,62,63,64],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01","This skill covers hardening managed Kubernetes clusters on EKS, AKS, and GKE by implementing Pod Security Standards, network policies, workload identity, RBAC scoping, image admission controls, and runtime security monitoring. It addresses cloud-specific security features including IRSA for EKS, Workload Identity for GKE, and Managed Identities for AKS.\n",[67,68,69,70,71],"T1078.004","T1530","T1537","T1580","T1610","main","7925716f065257435fdb12e97f7e52842147d5ad",".claude\u002Fskills\u002Fsecuring-kubernetes-on-cloud","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude","https:\u002F\u002Fclaude.com\u002Fclaude-code","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho","Software · Applied AI · Quantitative Modeling · Building with Claude.","2026-06-10 12:24:46",{"source":8,"skillName":5,"commands":81,"prompt":91,"zipAvailable":92},[82,85,88],{"tool":83,"command":84},"npx","npx skills add henriquescastilho\u002Fmy-claude --skill securing-kubernetes-on-cloud",{"tool":86,"command":87},"bunx","bunx skills add henriquescastilho\u002Fmy-claude --skill securing-kubernetes-on-cloud",{"tool":89,"command":90},"pnpm","pnpm dlx skills add henriquescastilho\u002Fmy-claude --skill securing-kubernetes-on-cloud","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002FSKILL.md",true,[94,99,105],{"path":95,"resourceType":95,"resourceTypeDesc":96,"sizeBytes":97,"sourceHtmlUrl":98},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002FLICENSE",{"path":100,"resourceType":101,"resourceTypeDesc":102,"sizeBytes":103,"sourceHtmlUrl":104},"references\u002Fapi-reference.md","REFERENCE","参考文档",2273,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002Freferences\u002Fapi-reference.md",{"path":106,"resourceType":107,"resourceTypeDesc":108,"sizeBytes":109,"sourceHtmlUrl":110},"scripts\u002Fagent.py","SCRIPT","脚本",8705,"https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002Fscripts\u002Fagent.py",[112,153,162,171,192,218],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":133,"publishedAt":50},"01M6F0B6XPQ65AX2X0DWK8KT3E","markitdown","Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.","MIT","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[119,122,125,128],{"categoryNo":120,"categoryName":121,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000003","演示文稿",{"categoryNo":126,"categoryName":127,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000004","电子表格",{"categoryNo":129,"categoryName":130,"taxonomyType":131,"taxonomyTypeDesc":132},"01JBSEEDCAT000000000000034","行政与办公人员","PROFESSION","适用职业",[114,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152],"docx","PDF","pptx","xlsx","documents","csv","ocr","Audio","Bash","markdown","convert","read","write","edit","html","images","files","youtube","with",{"skillNo":154,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":161,"publishedAt":50},"01M6F06SBHR9F0SDWE282Y8075","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002Fscientific_writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[157,158,159,160],{"categoryNo":120,"categoryName":121,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":126,"categoryName":127,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":129,"categoryName":130,"taxonomyType":131,"taxonomyTypeDesc":132},[114,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152],{"skillNo":163,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":170,"publishedAt":50},"01M6F02D4R14EJAPBWVDF9J9VQ","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-writer\u002F.claude\u002Fskills\u002Fmarkitdown\u002FSKILL.md",[166,167,168,169],{"categoryNo":120,"categoryName":121,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":126,"categoryName":127,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":129,"categoryName":130,"taxonomyType":131,"taxonomyTypeDesc":132},[114,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152],{"skillNo":172,"name":173,"nameZh":6,"description":174,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":175,"categories":176,"keywords":177,"publishedAt":50},"01M6F000KS6YB4MKS774G4R8ND","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fzarr-python\u002FSKILL.md",[],[178,179,180,181,182,183,32,184,185,186,187,188,189,190,191],"python","zarr python","storage","integration","s3","gcs","dask","parallel","pipelines","arrays","numpy","scientific computing","scale","scientific",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":196,"categories":197,"keywords":199,"publishedAt":50},"01M6EZZJWFXM1GR78KTW6J0DN8","what-if-oracle","Run structured What-If scenario analysis with multi-branch possibility exploration. Use this skill when the user asks speculative questions like \"what if...\", \"what would happen if...\", \"what are the possibilities\", \"explore scenarios\", \"scenario analysis\", \"possibility space\", \"what could go wrong\", \"best case \u002F worst case\", \"risk analysis\", \"contingency planning\", \"strategic options\", or any question about uncertain futures. Also trigger when the user faces a fork-in-the-road decision, wants to stress-test an idea, or needs to think through consequences before committing.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fwhat-if-oracle\u002FSKILL.md",[198],{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},[200,201,202,203,204,205,206,207,208,209,210,145,146,211,212,213,214,215,216,217],"oracle","what if oracle","go","run","ux","futures","analysis","explore","decision","branch","question","idea","exploration","options","stress-test","strategies","scenario","stress",{"skillNo":219,"name":220,"nameZh":6,"description":221,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":116,"licenseFileUrl":6,"sourceHtmlUrl":222,"categories":223,"keywords":234,"publishedAt":50},"01M6EZZCXAEB49RXGQCJX5E8GB","venue-templates","Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.","https:\u002F\u002Fgithub.com\u002Fhenriquescastilho\u002Fmy-claude\u002Fblob\u002Fmain\u002F.codex\u002Fvendor_imports\u002Fclaude\u002Fmarketplaces\u002Fclaude-scientific-skills\u002Fscientific-skills\u002Fvenue-templates\u002FSKILL.md",[224,227,230,231],{"categoryNo":225,"categoryName":226,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":228,"categoryName":229,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",{"categoryNo":27,"categoryName":28,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":232,"categoryName":233,"taxonomyType":131,"taxonomyTypeDesc":132},"01JBSEEDCAT000000000000036","内容创作者",[235,236,237,238,239,240,241,242,142,243,145,146,147,244,245,246,247,248,191,249],"templates","venue templates","research","guidelines","NeurIPS","ICML","LaTeX","science","access","proposals","Academic","requirements","formatting","journal","chi"]