GKE App Onboarding

GKE App Onboarding

Guides an agent through containerizing an application and deploying it to GKE for the first time, from assessment to Dockerfile and deployment manifests.

Skill files8 files

assets/

references/

SKILL.md166 lines
1
---
2
name: gke-app-onboarding
3
description: >-
4
Manages GKE application onboarding, covering containerization, deployment
5
manifests, and migration. Use when onboarding or deploying an application to
6
GKE for the first time, or containerizing an app for GKE. Don't use for
7
general GKE cluster administration or upgrades (use gke-basics or
8
gke-upgrades instead).
9
metadata:
10
version: "1.0.1"
11
category: Containers
12
---
13
14
# GKE App Onboarding
15
16
This reference provides workflows for containerizing and deploying applications
17
to GKE for the first time.
18
19
> **MCP Tools:** `apply_k8s_manifest`, `get_k8s_resource`,
20
> `get_k8s_rollout_status`, `get_k8s_logs`, `describe_k8s_resource`
21
22
## Attribution
23
24
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
25
MUST read [Usage Attribution](references/attribution.md). For commands executed
26
directly in the terminal (never in generated scripts, Terraform, or user code),
27
prefix `gcloud` with
28
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-app-onboarding)"`
29
and append `agent-skills/1.0 (skill:gke-app-onboarding)` to `User-Agent` headers.
30
31
## Workflow
32
33
### 1. App Assessment
34
35
Before containerizing, assess the application:
36
37
- **Language & Framework**: Identify the tech stack
38
- **Dependencies**: List required libraries and external services
39
- **Configuration**: How is the app configured? (env vars, config files,
40
secrets)
41
- **Statefulness**: Does it need persistent storage? (databases, file storage)
42
- **Networking**: Port mapping and protocol (HTTP, gRPC, TCP)
43
- **Health endpoints**: Does the app expose health check endpoints?
44
45
### 2. Containerization
46
47
Create a container image. A Dockerfile with a multi-stage build is recommended
48
for most apps — see the Go Dockerfile in
49
[`references/go-example.md`](./references/go-example.md) for a worked example.
50
51
**Best practices:**
52
53
- Use multi-stage builds to keep production images small
54
- Use distroless or minimal base images to reduce attack surface
55
- Run as non-root user
56
- Log to `stdout` and `stderr` for Cloud Logging collection
57
58
A complete worked Node.js example is provided in [`assets/`](./assets/):
59
[`Dockerfile`](./assets/Dockerfile) (non-root `node` user),
60
[`index.js`](./assets/index.js) (implements distinct `/healthz` and `/readyz`
61
endpoints), [`package.json`](./assets/package.json), and
62
[`deployment.yaml`](./assets/deployment.yaml) (hardened Deployment plus
63
ClusterIP Service, probes wired to `/healthz` and `/readyz`).
64
65
For applications where writing a Dockerfile is not preferred, you can use
66
[**Cloud Native Buildpacks**](https://buildpacks.io/) to automatically detect
67
the language and build a container image:
68
69
```bash
70
pack build <image> --builder gcr.io/buildpacks/builder:latest
71
```
72
73
### 3. Image Management
74
75
Build and store the container image:
76
77
```bash
78
# Configure Docker for Artifact Registry
79
gcloud auth configure-docker <REGION>-docker.pkg.dev --quiet
80
81
# Build and push
82
docker build -t <REGION>-docker.pkg.dev/<PROJECT>/<REPO>/<IMAGE>:<TAG> .
83
docker push <REGION>-docker.pkg.dev/<PROJECT>/<REPO>/<IMAGE>:<TAG>
84
```
85
86
**Vulnerability scanning**: Enable automatic scanning in Artifact Registry to
87
detect issues in base images and dependencies.
88
89
```bash
90
# Check scan results
91
gcloud artifacts docker images describe \
92
<REGION>-docker.pkg.dev/<PROJECT>/<REPO>/<IMAGE>:<TAG> \
93
--show-package-vulnerability \
94
--quiet
95
```
96
97
### 4. Manifest Generation
98
99
Generate Kubernetes manifests for the application. A baseline Deployment +
100
ClusterIP Service manifest (probes, resource requests/limits, 2 replicas) is in
101
[`references/go-example.md`](./references/go-example.md).
102
103
**Checklist for manifests:**
104
105
- Resource requests and limits set
106
- Liveness and readiness probes configured
107
- At least 2 replicas for production
108
- Service type appropriate (ClusterIP for internal, use Gateway API for
109
external)
110
111
See [`assets/deployment.yaml`](./assets/deployment.yaml) for a hardened worked
112
example. A production-hardened pod spec must include ALL of: `runAsNonRoot:
113
true`, `readOnlyRootFilesystem: true`, `allowPrivilegeEscalation: false`,
114
`capabilities.drop: ["ALL"]`, `seccompProfile: {type: RuntimeDefault}`,
115
`automountServiceAccountToken: false` (unless the pod needs the token — then say
116
why), resource requests, digest-pinned image, and a ClusterIP Service.
117
118
That checklist is the baseline for any pod spec produced here. For manifest work
119
beyond it — Gateway API routes, GCS FUSE and secret volume mounting, `subPath`
120
overlays, Spot VM targeting, or AI/inference serving specs — see
121
`gke-manifest-generation`.
122
123
### 5. Deploy
124
125
```
126
# MCP (preferred)
127
apply_k8s_manifest(parent="projects/<PROJECT>/locations/<REGION>/clusters/<CLUSTER>", yamlManifest="<manifest>")
128
129
# Verify
130
get_k8s_rollout_status(parent="...", resourceType="deployment", name="my-app")
131
get_k8s_resource(parent="...", resourceType="pod", labelSelector="app=my-app")
132
```
133
134
**kubectl fallback:**
135
136
```bash
137
kubectl apply -f manifests/
138
kubectl rollout status deployment/my-app
139
kubectl get pods -l app=my-app
140
```
141
142
## Golden Path Onboarding Checklist
143
144
For every production application onboarding to GKE:
145
146
1. **Container Security**: Non-root user (`runAsNonRoot: true`), lockfile
147
install, minimal/distroless base image.
148
2. **Resource Requests**: Explicit CPU and memory requests (mandatory for GKE
149
Autopilot).
150
3. **Health Probes**: Both liveness (`livenessProbe`) and readiness
151
(`readinessProbe`) probes configured.
152
4. **Reliability & Availability**: At least 2 replicas and a
153
`PodDisruptionBudget` (`minAvailable: 1` or `2`).
154
5. **IAM & Workload Identity**: Workload Identity
155
(`iam.gke.io/gcp-service-account`) instead of static service account keys.
156
157
## Next Steps
158
159
Once the application is running on GKE:
160
161
- Configure autoscaling — see the `gke-workload-scaling` skill
162
- Set up observability — see the `gke-observability` skill
163
- Harden security — see the `gke-workload-security` skill
164
- Configure reliability (PDBs, topology spread) — see the `gke-reliability`
165
skill
166

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

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 6,373 prompts

More by @OpenSourceBuffGuy

See all
Website Clone Architect prompt image

Website Clone Architect

Reverse-engineers a website section by section, writes component specs, and hands them to parallel builder agents in git worktrees to rebuild it.

agent-skill, orchestrator, parallel-agents, multi-agent, plan-then-execute, web-development, frontend, codebase-analysis, scaffolding, css, html, nextjs, typescript, git, mcp, claude-code, for-developers, for-designers, long-form, advanced, technical-spec, task-decomposition, structured-output, design-systems, ui-ux, tool-use, checklist, report, vibe-coding

Italian Terrace Cafe Candid Portrait prompt image

Italian Terrace Cafe Candid Portrait

Generates a photorealistic candid shot of a woman in a white corset dress laughing at a sunny hotel terrace cafe, written as detailed JSON.

image-prompt, json-prompt, structured-output, photorealistic, portrait, woman, candid, fashion, cottagecore, natural-light, golden-hour, bokeh, summer, travel, cityscape, mountains, medium-shot, vibrant-colors, for-photographers, nano-banana, fashion-shoot, luxury

Night Street Photo With Leashed Cat prompt image

Night Street Photo With Leashed Cat

Generates a flash-lit night street photo of a blonde woman in a retro track jacket walking a hissing tabby cat on a leash.

image-prompt, json-prompt, nano-banana, structured-output, portrait, woman, animals, pet-portrait, night-scene, street-photography, candid, editorial, fashion, dramatic-lighting, photorealistic, vertical-format, medium-shot, graffiti, for-photographers, for-content-creators

1 view

Reviews

Loading reviews…

Discussion

Loading comments…