[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HNYWMZ1TAAWBMTSV8GY2QB":3,"skill-same:01M6HNYWMZ1TAAWBMTSV8GY2QB":99},{"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":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":60,"commitSha":61,"skillDirectory":62,"forksCount":63,"repositoryHtmlUrl":64,"repositoryHomepageUrl":6,"ownerHtmlUrl":65,"ownerBlogUrl":6,"ownerDescription":66,"updatedAt":67,"install":68,"resources":81},"01M6HNYWMZ1TAAWBMTSV8GY2QB","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...","HenriqueMC17\u002Fagente-core","HenriqueMC17","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F206460478?v=4","01M6HB63HBBF18AC4H09XTB549","Henrique Monteiro Cardoso","01M6HB63NGSQXWKWCFWW2B20W0",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fsecuring-kubernetes-on-cloud\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"kubernetes","cloud","securing kubernetes on cloud","implementing","image","security standards","de","cm","pod-security-standards","security-standards","t1078","aks","gke","eks","network","cloud-security","monitoring","rbac","workload","cybersecurity","2026-11-10 10:12:30",false,"---\nname: securing-kubernetes-on-cloud\ndescription: 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...\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\ncategory: securing-kubernetes-on-cloud\n---\n# Securing-Kubernetes-On-Cloud\n\n## Overview\nThis 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\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## Overview\nThis 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\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",{"name":5,"tags":44,"author":47,"domain":38,"license":15,"version":48,"category":5,"nist_csf":49,"subdomain":34,"description":7,"mitre_attack":54},[45,32,30,31,27,46],"kubernetes-security","container-runtime","mahipal","1.0.0",[50,51,52,53],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01",[55,56,57,58,59],"T1078.004","T1530","T1537","T1580","T1610","main","5eea5b3296f4673b5f481e8bcc1ba76281149f16","modules\u002Fsecuring-kubernetes-on-cloud",0,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core","https:\u002F\u002Fgithub.com\u002FHenriqueMC17","Qualquer tecnologia suficientemente avançada é indistinguível da mágica.","2026-09-28 22:40:38",{"source":8,"skillName":5,"commands":69,"prompt":79,"zipAvailable":80},[70,73,76],{"tool":71,"command":72},"npx","npx skills add HenriqueMC17\u002Fagente-core --skill securing-kubernetes-on-cloud",{"tool":74,"command":75},"bunx","bunx skills add HenriqueMC17\u002Fagente-core --skill securing-kubernetes-on-cloud",{"tool":77,"command":78},"pnpm","pnpm dlx skills add HenriqueMC17\u002Fagente-core --skill securing-kubernetes-on-cloud","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fsecuring-kubernetes-on-cloud\u002FSKILL.md",true,[82,87,93],{"path":83,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fsecuring-kubernetes-on-cloud\u002FLICENSE",{"path":88,"resourceType":89,"resourceTypeDesc":90,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fapi-reference.md","REFERENCE","参考文档",2273,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fsecuring-kubernetes-on-cloud\u002Freferences\u002Fapi-reference.md",{"path":94,"resourceType":95,"resourceTypeDesc":96,"sizeBytes":97,"sourceHtmlUrl":98},"scripts\u002Fagent.py","SCRIPT","脚本",8705,"https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fsecuring-kubernetes-on-cloud\u002Fscripts\u002Fagent.py",[100,125,151,174,190,209],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":39},"01M6HPFF0RCN0X6WT5EBSV71GY","validating-backup-integrity-for-recovery","Validate backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to ensure backups are reliable for disaster recovery and ransomware response scenarios.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Fvalidating-backup-integrity-for-recovery\u002FSKILL.md",[],[107,108,109,110,111,112,38,113,114,115,116,117,118,29,119,120,121,122,123,124],"integrity","backup","recovery","validating backup integrity for recovery","for","testing","validate","verification","hash-verification","incident-response","ransomware","detection","t1490","disaster-recovery","restore","incident","disaster recovery","ransomware response",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":39},"01M6HPFAWJVFK25Q33K3T7WQ8G","triaging-vulnerabilities-with-ssvc-framework","Triage and prioritize vulnerabilities using CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree framework to produce actionable remediation priorities.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-vulnerabilities-with-ssvc-framework\u002FSKILL.md",[],[132,133,134,135,136,38,137,138,139,140,141,142,143,144,145,146,147,148,149,150],"vulnerabilities","framework","ssvc","triaging vulnerabilities with ssvc framework","with","triage and prioritize","CISA","vulnerability-management","risk-management","cvss","remediation","vulnerability","prioritization","decision-tree","prioritize","decision","priorities","actionable","tree",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":39},"01M6HPF6JS9X72WP59094H3ASQ","triaging-security-incident","Performs initial triage of security incidents to determine severity, scope, and required response actions using the NIST SP 800-61r3 and SANS PICERL frameworks. Classifies incidents by type, assigns priority based on business impact, and routes...","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-incident\u002FSKILL.md",[],[158,159,122,38,160,161,162,29,119,163,164,165,166,167,168,169,170,171,172,173],"security","triaging security incident","actions","soc","NIST","analysis","severity-classification","incident-triage","SANS-PICERL","SOC-operations","picerl","conversion","isolation","scope","impact","consistency",{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":180,"publishedAt":39},"01M6HPF2EX6ZYNYYHKBRJN7GEF","triaging-security-incident-with-ir-playbook","Classify and prioritize security incidents using structured IR playbooks to determine severity, assign response teams, and initiate appropriate response procedures.","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-incident-with-ir-playbook\u002FSKILL.md",[],[158,181,182,159,122,136,38,183,161,116,184,185,29,119,186,164,146,187,188,189],"playbook","triaging security incident with ir playbook","teams","IR-playbook","severity","classification","classify","incidents","initiate",{"skillNo":191,"name":192,"nameZh":6,"description":193,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":194,"categories":195,"keywords":196,"publishedAt":39},"01M6HPEY9XPGE7X95AG4XJFQAW","triaging-security-alerts-in-splunk","Triages security alerts in Splunk Enterprise Security by classifying severity, investigating notable events, correlating related telemetry, and making escalation or closure decisions using SPL queries and the Incident Review dashboard. Use when...","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftriaging-security-alerts-in-splunk\u002FSKILL.md",[],[158,197,198,199,200,201,38,202,203,204,161,205,29,206,207,208,167,26,122,25],"security alerts","splunk","triaging security alerts in splunk","alerts","review","siem","dashboard","search","correlation-search","t1566","notable-events","incident-review",{"skillNo":210,"name":211,"nameZh":6,"description":212,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":213,"categories":214,"keywords":215,"publishedAt":39},"01M6HPET6XGEPEJPN7V032JGZ0","tracking-threat-actor-infrastructure","Threat actor infrastructure tracking involves monitoring and mapping adversary-controlled assets including command-and-control (C2) servers, phishing domains, exploit kit hosts, bulletproof hosting, a","https:\u002F\u002Fgithub.com\u002FHenriqueMC17\u002Fagente-core\u002Fblob\u002Fmain\u002Fmodules\u002Ftracking-threat-actor-infrastructure\u002FSKILL.md",[],[216,217,218,219,38,35,220,221,222,223,224,206,225,226,26,227,25,228,229,230],"infrastructure","tracking threat actor infrastructure","tracking","threat","mitre-attack","threat-actor","threat-intelligence","command-and-control","dns","command","exploit","intelligence","domains","kit","hosts"]