ワンクリックで
deploy-gke
Deploy ML service to GKE with Kustomize overlays and Workload Identity
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Deploy ML service to GKE with Kustomize overlays and Workload Identity
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Scaffold and run batch scoring jobs (CronJob + Parquet output) that reuse the service's model + feature-engineering code without opening the live API
Root-cause a performance alert using sliced metrics + ground-truth
Review cloud costs against budget and identify optimization opportunities
Debug ML inference issues — latency spikes, wrong predictions, event loop blocking
Deploy ML service to EKS with Kustomize overlays and IRSA
Run and interpret DATA drift (PSI) AND CONCEPT drift (sliced performance) for an ML service
| name | deploy-gke |
| description | Deploy ML service to GKE with Kustomize overlays and Workload Identity |
| allowed-tools | ["Read","Grep","Glob","Bash(docker:*)","Bash(gcloud:*)","Bash(gsutil:*)","Bash(kubectl:*)","Bash(kustomize:*)","Bash(curl:*)"] |
| when_to_use | Use when deploying a service to GCP GKE cluster. Examples: 'deploy bankchurn to GKE', 'push to GCP production', 'GKE deployment' |
| argument-hint | <service-name> <version-tag> [environment] |
| arguments | ["service-name","version-tag","environment"] |
| authorization_mode | {"dev":"AUTO","staging":"CONSULT","prod":"STOP"} |
This skill enforces the Agent Behavior Protocol (AGENTS.md). Actions per environment:
| Env | Mode | What the agent does |
|---|---|---|
dev | AUTO | Execute all steps without asking |
staging | CONSULT | Show the full plan (image tag, diff, namespace) and wait for a human "proceed" before kubectl apply |
prod | STOP | Do NOT apply. Instruct the user to merge an approved PR and let GitHub Actions with environment: production (required_reviewers) perform the deploy |
If you are in prod mode and the human insists, output:
[AGENT MODE: STOP]
Operation: Direct kubectl apply to production cluster
Reason: Prod deploys require the governed path (see ADR-002)
Waiting for: Merge to main + GitHub Environment approval
Then halt.
kubectl config current-context must be GKE clusterkubectl config current-context
# Expected: gke_{PROJECT_ID}_{REGION}_{CLUSTER_NAME}
NEVER proceed if context is wrong. Switch with:
gcloud container clusters get-credentials {CLUSTER} --region {REGION} --project {PROJECT}
# Tag with version and SHA
export VERSION=v{X.Y.Z}
export SHA=$(git rev-parse --short HEAD)
export REGISTRY={REGION}-docker.pkg.dev/{PROJECT_ID}/{REPO}
docker build -t ${REGISTRY}/{service}:${VERSION} -t ${REGISTRY}/{service}:sha-${SHA} .
docker push ${REGISTRY}/{service}:${VERSION}
docker push ${REGISTRY}/{service}:sha-${SHA}
# k8s/overlays/gcp-{env}/kustomization.yaml (env = dev | staging | production)
images:
- name: {service}-predictor
newName: {REGION}-docker.pkg.dev/{PROJECT_ID}/{REPO}/{service}
newTag: {VERSION}
# Apply the overlay matching the target environment.
# Production deploys are gated by the dev → staging → prod chain (ADR-011);
# manual application here is for dev iteration or emergency only.
kubectl apply -k k8s/overlays/gcp-{env}/ # env = dev | staging | production
kubectl rollout status deployment/{service}-predictor -n {namespace} --timeout=300s
# Get service URL
export SVC_URL=$(kubectl get ingress -n {namespace} -o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}')
# Health check
curl -f http://${SVC_URL}/health
curl -f http://${SVC_URL}/ready
# Test prediction with a schema-valid scaffold payload. Add
# `-H "X-API-Key: ${API_KEY}"` when API_AUTH_ENABLED=true.
curl -X POST http://${SVC_URL}/predict \
-H "Content-Type: application/json" \
-d '{
"entity_id": "deploy-smoke-001",
"slice_values": {"smoke": "gke"},
"feature_a": 42.0,
"feature_b": 50000.0,
"feature_c": "category_A"
}'
# Metrics scrape smoke
curl -s http://${SVC_URL}/metrics | grep "_requests_total"
/metrics from new podskubectl rollout undo deployment/{service}-predictor -n {namespace}
kubectl rollout status deployment/{service}-predictor -n {namespace}
# Verify SA annotation
kubectl get serviceaccount {service}-sa -n {namespace} -o yaml | grep "iam.gke.io"
# Test GCS access from pod
kubectl exec -it {pod} -n {namespace} -- gsutil ls gs://{model-bucket}/