gke-manifest
Skill0 starsChanged 4 months agoMITView on GitHub
Generate GKE-tailored Kubernetes manifests that use Workload Identity, BackendConfig, and Ingress with Google-managed certificates. Use when the user asks to deploy to GKE, set up Workload Identity for a workload, expose a service through a Google-managed certificate, or configure health checks and CDN through BackendConfig.
In this repository5 other files it gives its agents.
- cloud-run-deploySkill
- firestore-rulesSkill
- gcloud-debugSkill
- iam-auditSkill
- terraform-gcpSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Write GKE-flavored Kubernetes YAML that uses GCP features: Workload Identity for GCP API auth, BackendConfig for the GCLB health check and …
- Distinctive: line 20
If inputs are missing, ask:
- Very specific: line 31
BackendConfig: every Service fronted by GCLB has a matching BackendConfig.
- Very specific: line 33
Pinned image tag: Never latest.
- Very specific: line 42
Write each manifest as its own file under k8s/ (or the existing layout).
- Very specific: line 293
Do not set runAsUser: 0 or leave runAsNonRoot unset.
- Very specific: line 294
Do not use latest for the image tag.
- Distinctive: line 295
Do not use Kubernetes Secrets in plain text for GCP credentials.
- Very specific: line 296
Do not annotate the default namespace ServiceAccount with iam.gke.io/gcp-service-account.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Generate GKE manifests
Write GKE-flavored Kubernetes YAML that uses GCP features: Workload Identity for GCP API auth, BackendConfig for the GCLB health check and CDN, and ManagedCertificate for TLS.
Inputs
$ARGUMENTS is a description of the workload. Examples:
api behind managed cert at api.example.com, replicas 3, needs Firestore readworker that reads from Pub/Sub subscription orders-workerinternal service for other clusters
If inputs are missing, ask:
- Image and tag.
- Hostname for the Ingress, or confirm the workload is cluster-internal.
- Whether the workload needs to call GCP APIs, and if so which ones. This drives Workload Identity.
- Which GCP service account to bind the Kubernetes service account to.
- Namespace. Default to
defaultonly for examples, otherwise ask.
Required characteristics
- Workload Identity: the Kubernetes ServiceAccount is annotated with
iam.gke.io/gcp-service-account: <gsa-email>. The GSA separately getsroles/iam.workloadIdentityUserforserviceAccount:<project>.svc.id.goog[<ns>/<ksa>]. - BackendConfig: every Service fronted by GCLB has a matching BackendConfig. Wire it with the Service annotation
cloud.google.com/backend-config: '{"default":"<name>"}'. - ManagedCertificate: TLS is provided by a
ManagedCertificateCR. The Ingress references it via the annotationnetworking.gke.io/managed-certificates. - Pinned image tag. Never
latest. - Resource requests and limits on every container.
- Readiness and liveness probes that match the BackendConfig health check path when the workload is behind GCLB.
- Security context:
runAsNonRoot: true, a specificrunAsUser,allowPrivilegeEscalation: false,capabilities.drop: ["ALL"], andreadOnlyRootFilesystem: truewhen the app allows it. - Common labels:
app.kubernetes.io/nameandapp.kubernetes.io/instanceon every object.
Output steps
- State the files and their target paths.
- Write each manifest as its own file under
k8s/(or the existing layout). - Print the kubectl commands to apply and verify.
- Print the one-time
gcloudcommands to create the GSA and bind Workload Identity.
Example: HTTP API with Workload Identity, BackendConfig, and ManagedCertificate
One-time setup (run once per workload):
PROJECT_ID=my-project
NS=default
KSA=api
GSA=api-runtime
gcloud iam service-accounts create $GSA \
--display-name="Runtime SA for $KSA"
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member=serviceAccount:$GSA@$PROJECT_ID.iam.gserviceaccount.com \
--role=roles/datastore.user
gcloud iam service-accounts add-iam-policy-binding \
$GSA@$PROJECT_ID.iam.gserviceaccount.com \
--role=roles/iam.workloadIdentityUser \
--member="serviceAccount:$PROJECT_ID.svc.id.goog[$NS/$KSA]"File k8s/serviceaccount.yaml:
apiVersion: v1
kind: ServiceAccount
metadata:
name: api
namespace: default
annotations:
iam.gke.io/gcp-service-account: api-runtime@my-project.iam.gserviceaccount.com
labels:
app.kubernetes.io/name: api
app.kubernetes.io/instance: apiFile k8s/deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
labels:
app.kubernetes.io/name: api
app.kubernetes.io/instance: api
spec:
replicas: 3
selector:
matchLabels:
app.kubernetes.io/name: api
template:
metadata:
labels:
app.kubernetes.io/name: api
app.kubernetes.io/instance: api
spec:
serviceAccountName: api
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 1000
containers:
- name: api
image: us-central1-docker.pkg.dev/my-project/app/api:1.0.0
ports:
- name: http
containerPort: 8080
env:
- name: GOOGLE_CLOUD_PROJECT
value: my-project
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
readinessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 5
periodSeconds: 5
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 15
periodSeconds: 10
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]File k8s/service.yaml:
apiVersion: v1
kind: Service
metadata:
name: api
labels:
app.kubernetes.io/name: api
app.kubernetes.io/instance: api
annotations:
cloud.google.com/backend-config: '{"default":"api"}'
cloud.google.com/neg: '{"ingress": true}'
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: api
ports:
- name: http
port: 80
targetPort: httpFile k8s/backendconfig.yaml:
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: api
spec:
timeoutSec: 60
connectionDraining:
drainingTimeoutSec: 60
healthCheck:
checkIntervalSec: 10
timeoutSec: 5
healthyThreshold: 1
unhealthyThreshold: 3
type: HTTP
requestPath: /healthz
port: 8080
logging:
enable: true
sampleRate: 1.0File k8s/managedcertificate.yaml:
apiVersion: networking.gke.io/v1
kind: ManagedCertificate
metadata:
name: api-cert
spec:
domains:
- api.example.comFile k8s/ingress.yaml:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: api
annotations:
kubernetes.io/ingress.class: "gce"
kubernetes.io/ingress.global-static-ip-name: api-static-ip
networking.gke.io/managed-certificates: api-cert
networking.gke.io/v1beta1.FrontendConfig: api-frontend
spec:
rules:
- host: api.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: api
port:
name: httpFile k8s/frontendconfig.yaml (forces HTTP to HTTPS):
apiVersion: networking.gke.io/v1beta1
kind: FrontendConfig
metadata:
name: api-frontend
spec:
redirectToHttps:
enabled: true
responseCodeName: MOVED_PERMANENTLY_DEFAULTReserve the global static IP once (outside the cluster):
gcloud compute addresses create api-static-ip --global
gcloud compute addresses describe api-static-ip --global --format='value(address)'Point DNS for api.example.com at that IP. Certificate issuance will fail until DNS resolves.
Apply:
kubectl apply -f k8s/
kubectl rollout status deployment/api
kubectl get ingress api
kubectl describe managedcertificate api-certCertificate provisioning takes 10 to 60 minutes. The ManagedCertificate must show status.certificateStatus: Active before HTTPS works.
Example: internal service (no public ingress)
Skip the Ingress, ManagedCertificate, and FrontendConfig. Keep the Deployment, Service, ServiceAccount, and BackendConfig. Use an internal load balancer if needed:
apiVersion: v1
kind: Service
metadata:
name: worker
annotations:
networking.gke.io/load-balancer-type: "Internal"
spec:
type: LoadBalancer
selector:
app.kubernetes.io/name: worker
ports:
- name: http
port: 80
targetPort: 8080Common pitfalls
- Node pool must have Workload Identity enabled (
--workload-pool=<project>.svc.id.googon the cluster,--workload-metadata=GKE_METADATAon the node pool). Without both, pods fall back to the node service account. - The ManagedCertificate status is separate from Ingress status. Check both.
- The Service must have
type: ClusterIPorNodePortfor GCLB.LoadBalancercreates a Network LB, not an HTTP LB. cloud.google.com/neg: '{"ingress": true}'on the Service is required for container-native load balancing. Without it, GCLB routes to node IPs and health checks can be misleading.
Do not
- Do not set
runAsUser: 0or leaverunAsNonRootunset. - Do not use
latestfor the image tag. - Do not use Kubernetes Secrets in plain text for GCP credentials. Use Workload Identity instead.
- Do not annotate the default namespace ServiceAccount with
iam.gke.io/gcp-service-account. Create a dedicated KSA per workload.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

