[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ABAMN282ZR44VMHYRDFX84":3,"skill-same:01M7ABAMN282ZR44VMHYRDFX84":85},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":14,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M7ABAMN282ZR44VMHYRDFX84","securing-kubernetes-on-cloud",null,"Hardens managed Kubernetes clusters on EKS, AKS, and GKE by implementing Pod Security Standards, network policies, workload identity (IRSA for EKS, Workload Identity for GKE, Managed Identities for AKS), RBAC scoping, image admission controls, and runtime security monitoring. Use when deploying a new managed Kubernetes cluster with security requirements or hardening an existing EKS, AKS, or GKE cluster after an audit or pentest finding.","NeelakshSaxena\u002FVayu","NeelakshSaxena","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F87892838?v=4","01M7A3B9YFS6F6N9DD1787DT86","Neelaksh Saxena","01M7A3B9ZKBT09MNMPX2XN69BY",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: securing-kubernetes-on-cloud\ndescription: 'Hardens managed Kubernetes clusters on EKS, AKS, and GKE by implementing\n  Pod Security Standards, network policies, workload identity (IRSA for EKS, Workload\n  Identity for GKE, Managed Identities for AKS), RBAC scoping, image admission controls,\n  and runtime security monitoring. Use when deploying a new managed Kubernetes cluster\n  with security requirements or hardening an existing EKS, AKS, or GKE cluster after\n  an audit or pentest finding.\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":25,"author":32,"domain":33,"license":15,"version":34,"nist_csf":35,"subdomain":40,"description":41,"mitre_attack":42},[26,27,28,29,30,31],"kubernetes-security","eks","aks","gke","pod-security-standards","container-runtime","mahipal","cybersecurity","1.0.0",[36,37,38,39],"PR.IR-01","ID.AM-08","GV.SC-06","DE.CM-01","cloud-security","Hardens managed Kubernetes clusters on EKS, AKS, and GKE by implementing Pod Security Standards, network policies, workload identity (IRSA for EKS, Workload Identity for GKE, Managed Identities for AKS), RBAC scoping, image admission controls, and runtime security monitoring. Use when deploying a new managed Kubernetes cluster with security requirements or hardening an existing EKS, AKS, or GKE cluster after an audit or pentest finding.\n",[43,44,45,46,47],"T1078.004","T1530","T1537","T1580","T1610","main","7540bbccf0c1ded6156a467b02c95b61ad62413f",".agents\u002Fskills\u002Fsecuring-kubernetes-on-cloud","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena","Currently exploring the intersection of tech","2026-09-11 03:02:31",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add NeelakshSaxena\u002FVayu --skill securing-kubernetes-on-cloud",{"tool":61,"command":62},"bunx","bunx skills add NeelakshSaxena\u002FVayu --skill securing-kubernetes-on-cloud",{"tool":64,"command":65},"pnpm","pnpm dlx skills add NeelakshSaxena\u002FVayu --skill securing-kubernetes-on-cloud","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002FSKILL.md",true,[69,73,79],{"path":70,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fapi-reference.md","REFERENCE","参考文档",2273,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002Freferences\u002Fapi-reference.md",{"path":80,"resourceType":81,"resourceTypeDesc":82,"sizeBytes":83,"sourceHtmlUrl":84},"scripts\u002Fagent.py","SCRIPT","脚本",8705,"https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fsecuring-kubernetes-on-cloud\u002Fscripts\u002Fagent.py",[86,93,100,107,114,121],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":20},"01M7ACCCVNCFKMA9X6D15X6G98","runpodctl","Runpod CLI for managing GPU\u002FCPU workloads from the terminal — pods, serverless endpoints, templates, network volumes, Hub deploys, models, SSH, and file transfer (send\u002Freceive). Use for terminal\u002FCI\u002Fscripting, Hub browse\u002Fdeploy, SSH setup, `doctor`, or when the Runpod MCP tools are not connected. For structured tool calls in an MCP-enabled session, prefer runpod-mcp.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpodctl\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":20},"01M7ACC63SRHEA5KMCHSMZK2TC","runpod","Start here for any Runpod task — running GPU\u002FCPU pods, deploying serverless endpoints, templates, network volumes, building images, or understanding how Runpod works. Routes to the right skill (runpod-mcp, runpodctl, flash, companion-clis, runpod-usage, runpod-templates, runpod-migrate) and indexes two dozen live-verified end-to-end examples (golden paths) — use it when the lane is unclear, and for any multi-step or provisioning task even when it is not.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod\u002FSKILL.md",[],[],{"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":20},"01M7ACC0Q1C89N9BZBV91CTQTF","runpod-usage","How Runpod works and how to work it — pods vs serverless, GPU\u002FVRAM selection, storage, building a container, networking, plus the agentic pod development loop (provision → ssh-exec → set up → poll readiness) and on-pod install hygiene (uv\u002Fapt). Use to answer \"how does X work\", \"which GPU\", \"how do I build a container\", or \"how do I stand up a workload on a pod\". Guidance, not a tool — execute with runpodctl, runpod-mcp, or flash.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-usage\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":20},"01M7ACBRPE345GF5GM5B8P8RRC","runpod-templates","Runpod's official prebuilt pod templates (ComfyUI, PyTorch, and others): what each image ships, which ports and paths it uses, how to pick one, how to pin a version, and what is missing on first boot. Use when a task says \"run \u003CX> on a pod\" and an official template already covers it, instead of building an image — and when a user needs help with or wants to fix something about a Runpod template they are already running (won't boot, can't reach the UI, missing models, wrong CUDA line, broken ComfyUI workflow metadata on imported workflows): start here and route onward. Deploy with runpodctl or runpod-mcp; end-to-end walkthroughs live in the runpod router's golden paths.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-templates\u002FSKILL.md",[],[],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":20},"01M7ACBJATHKVX1TWES2F44GY8","runpod-migrate","Migrate a codebase from the Runpod GraphQL API or REST v1 to REST v2 — inventory which parts use which API version, rewrite the call sites, flag breaking changes, and verify. Use when someone asks to move to v2, asks what v2 would change, or asks which Runpod API their code is on. For managing infrastructure rather than migrating code, use runpod-mcp or runpodctl.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-migrate\u002FSKILL.md",[],[],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":20},"01M7ACBC7GHVH6T9YEAPCG2AP8","runpod-mcp","Manage Runpod infrastructure — pods, serverless endpoints, jobs, templates, network volumes, container-registry auth, GPU\u002FCPU catalog, and billing — via the Runpod MCP server's structured tool calls. Use when the Runpod MCP tools (create-pod, list-endpoints, …) are connected in this session, or to connect them (hosted OAuth or local npx). Prefer this over runpodctl for plain infra CRUD when MCP is available; use runpodctl for the terminal, file transfer, or SSH setup.","https:\u002F\u002Fgithub.com\u002FNeelakshSaxena\u002FVayu\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Frunpod-mcp\u002FSKILL.md",[],[]]