Agent skill
gke-workload-security
Workflows for auditing and hardening the security of GKE workloads.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/gke-workload-security
SKILL.md
GKE Workload Security
This skill provides workflows and best practices for securing GKE workloads. It covers security auditing, Identity and Access Management (Workload Identity), Network Security (Network Policies), and Node Security.
Workflows
1. Security Audit
Assess the current security posture of your cluster using the provided audit script.
Capabilities:
- Checks for Workload Identity.
- Verifies Network Policy is enabled.
- Checks if Shielded Nodes are enabled.
- Checks if Binary Authorization is enabled.
- Checks for Private Cluster configuration.
Command:
./.agent/skills/gke-workload-security/scripts/audit_cluster.sh <cluster-name> <region> <project-id>
2. Configure Workload Identity
Workload Identity allows Kubernetes Service Accounts (KSAs) to impersonate Google Service Accounts (GSAs). This is the recommended method for workloads to access Google Cloud APIs.
Steps:
-
Create Namespace and KSA:
bashkubectl create namespace workload-identity-test-ns kubectl create serviceaccount <ksa-name> \ --namespace workload-identity-test-ns -
Bind KSA to GSA:
bashgcloud iam service-accounts add-iam-policy-binding <gsa-name>@<project-id>.iam.gserviceaccount.com \ --role roles/iam.workloadIdentityUser \ --member "serviceAccount:<project-id>.svc.id.goog[workload-identity-test-ns/<ksa-name>]" -
Annotate KSA:
bashkubectl annotate serviceaccount <ksa-name> \ --namespace workload-identity-test-ns \ iam.gke.io/gcp-service-account=<gsa-name>@<project-id>.iam.gserviceaccount.com -
Verify Example Pod: Use existing asset
assets/workload-identity-pod.yamlto test the configuration. Update the<ksa-name>in the file first.bashkubectl apply -f .agent/skills/gke-workload-security/assets/workload-identity-pod.yaml
3. Implement Network Policies
Control traffic flow between Pods using Network Policies. By default, all traffic is allowed.
Enable Network Policy Enforcement:
gcloud container clusters update <cluster-name> \
--update-addons=NetworkPolicy=ENABLED \
--region <region>
[!NOTE] If your cluster uses Dataplane V2 (
--enable-dataplane-v2), Network Policy enforcement is built-in and this step is not required (and may fail).
Apply Default Deny Policy: Isolate namespaces by denying all ingress and egress traffic by default.
Replace with the namespace you want to isolate.
kubectl apply -f .agent/skills/gke-workload-security/assets/default-deny-netpol.yaml -n
4. Enable Shielded Nodes
Ensure nodes are running with verifiable integrity.
Command:
gcloud container clusters update <cluster-name> \
--enable-shielded-nodes \
--region <region>
5. GKE Sandbox (gVisor)
Run untrusted workloads in a sandbox for extra isolation.
Enable GKE Sandbox:
gcloud container clusters update <cluster-name> \
--enable-gke-sandbox \
--region <region>
Run a Sandboxed Pod:
Add runtimeClassName: gvisor to your Pod spec.
Best Practices
- Least Privilege: Always use Workload Identity with minimal IAM roles. Avoid using Node default service accounts.
- Network Isolation: Use Network Policies to restrict Pod-to-Pod communication.
- Image Security: Use Binary Authorization to ensure only trusted images are deployed.
- Regular Audits: Run the audit script periodically to check for configuration drift.
- Private Clusters: Prefer Private Clusters to limit public exposure of the control plane and nodes.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?