GKE Platform Security

GKE Platform Security

Guides an AI agent in hardening Google Kubernetes Engine clusters: RBAC, Binary Authorization, secrets encryption, Shielded Nodes, Sandbox and IAM roles, using gcloud and MCP tools.

Skill files2 files

references/

SKILL.md214 lines
1
---
2
name: gke-platform-security
3
description: >-
4
Plans, configures, and hardens platform-level Google Kubernetes Engine (GKE)
5
cluster security. Covers cluster add-ons (Secret Manager enablement), RBAC
6
hardening (disabling insecure bindings, audit tools), Binary Authorization,
7
Secrets Encryption (--database-encryption-key), Security Posture (--security-posture),
8
enabling Shielded Nodes, GKE Sandbox cluster enablement, GKE IAM roles, and
9
cross-service authentication IAM patterns. Use when securing cluster control
10
planes, hardening GKE RBAC, enabling Shielded Nodes, enabling GKE Sandbox runtime,
11
enabling cluster-wide security add-ons, or managing GKE IAM roles. Don't use
12
for Workload Identity (use gke-workload-identity) or workload-level security
13
(SecretProviderClass, PSS, NetPol, gVisor pod runtimeClassName; use gke-workload-security).
14
metadata:
15
version: "1.0.3"
16
category: Security
17
---
18
19
# GKE Platform Security
20
21
This reference covers platform-level security hardening and cluster
22
configuration for Google Kubernetes Engine (GKE). For workload-level security
23
controls (such as Workload Identity Service Account bindings,
24
SecretProviderClass volume mounts, Network Policies, and Pod Security
25
Standards), refer to the `gke-workload-security` skill.
26
27
> **MCP Tools:** `gke:get_cluster`, `k8s:check_k8s_auth`,
28
> `k8s:get_k8s_resource`, `k8s:apply_k8s_manifest`, `gke:update_cluster`
29
30
## Attribution
31
32
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
33
MUST read [Usage Attribution](references/attribution.md). For commands executed
34
directly in the terminal (never in generated scripts, Terraform, or user code),
35
prefix `gcloud` with
36
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-platform-security)"`
37
and append `agent-skills/1.0 (skill:gke-platform-security)` to `User-Agent` headers.
38
39
## Golden Path Security Defaults
40
41
Setting | Golden Path Value | Day-0/1 | Notes
42
-------------------------------------------------------------- | --------------------------------------- | ------- | -----
43
`workloadIdentityConfig.workloadPool` | `<PROJECT>.svc.id.goog` | Day-0 | Workload Identity Federation for cluster pods
44
`secretManagerConfig.enabled` | `true` | Day-1 | Google Secret Manager cluster add-on integration
45
`secretManagerConfig.rotationConfig` | `enabled: true, rotationInterval: 120s` | Day-1 | Automatic secret rotation at the cluster level
46
`rbacBindingConfig.enableInsecureBindingSystemAuthenticated` | `false` | Day-0 | Blocks legacy `system:authenticated` bindings
47
`rbacBindingConfig.enableInsecureBindingSystemUnauthenticated` | `false` | Day-0 | Blocks legacy `system:unauthenticated` bindings
48
`nodeConfig.shieldedInstanceConfig.enableSecureBoot` | `true` | Day-0 | Verifiable boot integrity
49
`nodeConfig.shieldedInstanceConfig.enableIntegrityMonitoring` | `true` | Day-0 | Runtime integrity checks
50
`nodeConfig.workloadMetadataConfig.mode` | `GKE_METADATA` | Day-0 | Blocks legacy metadata API, enforces Workload Identity
51
Private cluster + Dataplane V2 settings | See the `gke-networking` skill | Day-0 | Private nodes, private endpoint enforcement, ADVANCED_DATAPATH
52
53
## Secret Manager Add-on Enablement
54
55
The golden path enables Secret Manager at the cluster level with automatic
56
secret rotation.
57
58
```bash
59
# Verify Secret Manager is enabled on cluster
60
gcloud container clusters describe <CLUSTER_NAME> --region <REGION> \
61
--format="value(secretManagerConfig.enabled)" \
62
--quiet
63
64
# Enable if not already (Day-1 change)
65
gcloud container clusters update <CLUSTER_NAME> --region <REGION> \
66
--enable-secret-manager \
67
--enable-secret-manager-rotation \
68
--secret-manager-rotation-interval=120s \
69
--quiet
70
```
71
72
> **Note:** For configuring `SecretProviderClass` manifests and mounting secrets
73
> as volumes inside application deployments, see the `gke-workload-security`
74
> skill.
75
76
## RBAC Hardening
77
78
The golden path disables insecure legacy RBAC bindings that grant broad access
79
to `system:authenticated` and `system:unauthenticated` groups.
80
81
```bash
82
# Verify insecure bindings are disabled
83
gcloud container clusters describe <CLUSTER_NAME> --region <REGION> \
84
--format="yaml(rbacBindingConfig)" \
85
--quiet
86
```
87
88
**Best practices for RBAC:**
89
90
- Use namespace-scoped Roles over cluster-wide ClusterRoles.
91
- Bind to specific Groups or ServiceAccounts, never to `system:authenticated`
92
or `system:unauthenticated`.
93
- Audit permissions via MCP: `k8s:check_k8s_auth(parent="...", verb="list",
94
resourceType="pods", namespace="...")` (or `kubectl auth can-i --list
95
--as=<user>`).
96
- Review bindings via MCP: `k8s:get_k8s_resource(parent="...",
97
resourceType="clusterrolebinding")` (or `kubectl get
98
clusterrolebindings,rolebindings --all-namespaces`).
99
100
> See the `gke-multitenancy` skill for enterprise RBAC planning and
101
> https://docs.cloud.google.com/kubernetes-engine/docs/best-practices/rbac.md.txt
102
103
## Binary Authorization
104
105
Not enabled in golden path by default but recommended for enforcing production
106
image provenance across the cluster:
107
108
```bash
109
# Enable Binary Authorization
110
gcloud container clusters update <CLUSTER_NAME> --region <REGION> \
111
--binauthz-evaluation-mode=PROJECT_SINGLETON_POLICY_ENFORCE \
112
--quiet
113
```
114
115
## Shielded Nodes & GKE Sandbox Enablement
116
117
Enabling verifiable node boot integrity and kernel isolation features at the
118
cluster level:
119
120
```bash
121
# Enable Shielded Nodes on an existing cluster
122
gcloud container clusters update <CLUSTER_NAME> --region <REGION> \
123
--enable-shielded-nodes \
124
--quiet
125
126
# Enable GKE Sandbox (gVisor) runtime on a Standard cluster node pool
127
gcloud container node-pools create <NODE_POOL_NAME> \
128
--cluster=<CLUSTER_NAME> \
129
--region=<REGION> \
130
--sandbox=type=gvisor \
131
--quiet
132
```
133
134
> **Note:** To run workloads inside the gVisor sandbox, specify
135
> `runtimeClassName: gvisor` in your Pod specs as detailed in the
136
> `gke-workload-security` skill.
137
138
## Common IAM Roles
139
140
The five most common predefined IAM roles for GKE platform and cluster access:
141
142
| Role | Purpose | When to Use |
143
| ------------------------------- | ------------------- | -------------------- |
144
| `roles/container.admin` | Full control over | Platform team admins |
145
: : clusters and : managing cluster :
146
: : Kubernetes : lifecycle :
147
: : resources : :
148
| `roles/container.clusterAdmin` | Manage clusters but | Cluster operators |
149
: : not project-level : who create/delete :
150
: : IAM : clusters :
151
| `roles/container.developer` | Deploy workloads | Application |
152
: : (pods, services, : developers deploying :
153
: : deployments) : to existing clusters :
154
| `roles/container.viewer` | Read-only access to | Monitoring, |
155
: : clusters and : auditing, or :
156
: : Kubernetes : read-only dashboards :
157
: : resources : :
158
| `roles/container.clusterViewer` | List and get | CI/CD pipelines that |
159
: : cluster details : need cluster :
160
: : only : metadata :
161
162
> **Principle of least privilege**: Start with `roles/container.viewer` or
163
> `roles/container.developer` and escalate only as needed. Avoid granting
164
> `roles/container.admin` broadly across teams.
165
166
## Service Accounts & Agents
167
168
- **GKE Service Agent**
169
(`service-<PROJECT_NUMBER>@container-engine-robot.iam.gserviceaccount.com`):
170
Automatically created. Manages nodes, networking, and cluster operations on
171
your behalf. Do not remove or modify its permissions.
172
- **Node Service Account**: By default, nodes use the Compute Engine default
173
service account. For production platforms, create a dedicated Google Service
174
Account with minimal required permissions (`roles/monitoring.metricWriter`,
175
`roles/logging.logWriter`) and assign it at node pool creation time.
176
- **Workload Identity**: For binding Google Service Accounts to Kubernetes
177
Service Accounts (`roles/iam.workloadIdentityUser`), refer to the
178
`gke-workload-security` skill.
179
180
## Cross-Service Authentication Patterns
181
182
Common project-level IAM policy binding patterns for granting backend Google
183
Service Accounts (GSAs) access to external Google Cloud services before linking
184
via Workload Identity:
185
186
```bash
187
# Grant a GSA access to Cloud Storage objects
188
gcloud projects add-iam-policy-binding <PROJECT_ID> \
189
--member "serviceAccount:<GSA_NAME>@<PROJECT_ID>.iam.gserviceaccount.com" \
190
--role "roles/storage.objectViewer" \
191
--quiet
192
193
# Grant a GSA access to Cloud SQL databases
194
gcloud projects add-iam-policy-binding <PROJECT_ID> \
195
--member "serviceAccount:<GSA_NAME>@<PROJECT_ID>.iam.gserviceaccount.com" \
196
--role "roles/cloudsql.client" \
197
--quiet
198
199
# Grant a GSA access to Pub/Sub subscriptions
200
gcloud projects add-iam-policy-binding <PROJECT_ID> \
201
--member "serviceAccount:<GSA_NAME>@<PROJECT_ID>.iam.gserviceaccount.com" \
202
--role "roles/pubsub.subscriber" \
203
--quiet
204
```
205
206
## Resources
207
208
- [GKE Cluster Hardening Guide](https://cloud.google.com/kubernetes-engine/docs/how-to/hardening-your-cluster)
209
- [GKE RBAC Best Practices](https://cloud.google.com/kubernetes-engine/docs/best-practices/rbac)
210
- [Secret Manager Add-on for GKE](https://cloud.google.com/secret-manager/docs/secret-manager-managed-csi-component)
211
- [Binary Authorization on GKE](https://cloud.google.com/binary-authorization/docs/setting-up)
212
- [Shielded GKE Nodes](https://cloud.google.com/kubernetes-engine/docs/how-to/shielded-gke-nodes)
213
- [GKE Sandbox (gVisor)](https://cloud.google.com/kubernetes-engine/docs/how-to/sandbox-pods)
214

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…