此登錄庫釘選版本所收錄的最新上游作者日期。

gke-app-onboarding

已同步 v1.0.0 授權: Apache-2.0 來源: google/skills/skills/cloud/gke-app-onboarding 提交: 99c871e 收錄的最新變更:

Manages GKE application onboarding, covering containerization, deployment manifests, and migration. Use when onboarding or deploying an application to GKE for the first time, or containerizing an app for GKE. Don't use for general GKE cluster administration or upgrades (use gke-basics or gke-upgrades instead).

摘要

用途
協助應用程式團隊評估應用程式、將其容器化、準備 Kubernetes 資訊清單,並部署至 GKE。
使用時機
當需要將應用程式整理成可在 GKE 執行的工作負載,從檢視執行環境與相依項目到確認首次部署時,請使用此技能。
輸出結果
提供建置與發布容器映像的實用指引與範例、建立 Kubernetes 資訊清單的方法,以及部署並驗證推出狀態和 Pod 狀態的步驟。
上游變更(9 筆,最新收錄 2026-09-21)
becc4b8 Enforce semantic versioning (MAJOR.MINOR.PATCH) for skills. 在此技能的 `metadata` 中新增值為 `1.0.0` 的 `version` 欄位。
40d70a4 Upgrade gke-app-onboarding skill. 將內嵌的容器與清單範例改為連結至完整範例,新增 Node.js 範例與強化 Pod 的要求,並加入正式環境上線檢查清單。
6aa329d Add gke-workload-security and rename gke-security to gke-platform-security 更新後續步驟指引,改為參照 `gke-workload-scaling` 與 `gke-workload-security`。
c75b500 Restructure the YAML frontmatter in all SKILL.md files to nest the 'category' field under the 'metadata:' block. The 'category' field is used to organize the skills in the README.md 在技能的 frontmatter 中新增含有 `category: Containers` 的 `metadata` 區塊。
5d9d054 Refactor GKE basic skill into individual skills 將參考文件提升為獨立的 `SKILL.md`,加入技能中繼資料並重新排版上線指引。
626910e Update gcloud examples to use --quiet. 在 Artifact Registry 的 Docker 驗證與映像描述範例中加入 `--quiet`。
6f0b877 Nests cloud/ skills under a top level skills/ directory 將上線參考文件移至 `skills/cloud/gke-basics/references/`,內容維持不變。
9114a94 Flatten skill directories to work with multiple installation tools 將上線參考文件從 `cloud/products/kubernetes-engine/gke-basics/references/` 移至 `cloud/gke-basics/references/`,內容維持不變。
d3e3bab No public description 新增 GKE 應用程式上線指南,涵蓋應用程式評估、容器與映像工作流程、Kubernetes 資訊清單、部署及後續技能。
npx skills add "lettucebo/Skills#v2.2.0@gke-app-onboarding" --full-depth

⚠ v2.2.0 發布後即可使用

GKE App Onboarding

This reference provides workflows for containerizing and deploying applications to GKE for the first time.

MCP Tools: apply_k8s_manifest, get_k8s_resource, get_k8s_rollout_status, get_k8s_logs, describe_k8s_resource

Workflow

1. App Assessment

Before containerizing, assess the application:

  • Language & Framework: Identify the tech stack
  • Dependencies: List required libraries and external services
  • Configuration: How is the app configured? (env vars, config files, secrets)
  • Statefulness: Does it need persistent storage? (databases, file storage)
  • Networking: Port mapping and protocol (HTTP, gRPC, TCP)
  • Health endpoints: Does the app expose health check endpoints?

2. Containerization

Create a container image. A Dockerfile with a multi-stage build is recommended for most apps — see the Go Dockerfile in references/go-example.md for a worked example.

Best practices:

  • Use multi-stage builds to keep production images small
  • Use distroless or minimal base images to reduce attack surface
  • Run as non-root user
  • Log to stdout and stderr for Cloud Logging collection

A complete worked Node.js example is provided in assets/: Dockerfile (non-root node user), index.js (implements distinct /healthz and /readyz endpoints), package.json, and deployment.yaml (hardened Deployment plus ClusterIP Service, probes wired to /healthz and /readyz).

For applications where writing a Dockerfile is not preferred, you can use Cloud Native Buildpacks to automatically detect the language and build a container image:

pack build <image> --builder gcr.io/buildpacks/builder:latest

3. Image Management

Build and store the container image:

# Configure Docker for Artifact Registry
gcloud auth configure-docker <REGION>-docker.pkg.dev --quiet

# Build and push
docker build -t <REGION>-docker.pkg.dev/<PROJECT>/<REPO>/<IMAGE>:<TAG> .
docker push <REGION>-docker.pkg.dev/<PROJECT>/<REPO>/<IMAGE>:<TAG>

Vulnerability scanning: Enable automatic scanning in Artifact Registry to detect issues in base images and dependencies.

# Check scan results
gcloud artifacts docker images describe \
  <REGION>-docker.pkg.dev/<PROJECT>/<REPO>/<IMAGE>:<TAG> \
  --show-package-vulnerability \
  --quiet

4. Manifest Generation

Generate Kubernetes manifests for the application. A baseline Deployment + ClusterIP Service manifest (probes, resource requests/limits, 2 replicas) is in references/go-example.md.

Checklist for manifests:

  • Resource requests and limits set
  • Liveness and readiness probes configured
  • At least 2 replicas for production
  • Service type appropriate (ClusterIP for internal, use Gateway API for external)

See assets/deployment.yaml for a hardened worked example. A production-hardened pod spec must include ALL of: runAsNonRoot: true, readOnlyRootFilesystem: true, allowPrivilegeEscalation: false, capabilities.drop: ["ALL"], seccompProfile: {type: RuntimeDefault}, automountServiceAccountToken: false (unless the pod needs the token — then say why), resource requests, digest-pinned image, and a ClusterIP Service.

That checklist is the baseline for any pod spec produced here. For manifest work beyond it — Gateway API routes, GCS FUSE and secret volume mounting, subPath overlays, Spot VM targeting, or AI/inference serving specs — see gke-manifest-generation.

5. Deploy

# MCP (preferred)
apply_k8s_manifest(parent="projects/<PROJECT>/locations/<REGION>/clusters/<CLUSTER>", yamlManifest="<manifest>")

# Verify
get_k8s_rollout_status(parent="...", resourceType="deployment", name="my-app")
get_k8s_resource(parent="...", resourceType="pod", labelSelector="app=my-app")

kubectl fallback:

kubectl apply -f manifests/
kubectl rollout status deployment/my-app
kubectl get pods -l app=my-app

Golden Path Onboarding Checklist

For every production application onboarding to GKE:

  1. Container Security: Non-root user (runAsNonRoot: true), lockfile install, minimal/distroless base image.
  2. Resource Requests: Explicit CPU and memory requests (mandatory for GKE Autopilot).
  3. Health Probes: Both liveness (livenessProbe) and readiness (readinessProbe) probes configured.
  4. Reliability & Availability: At least 2 replicas and a PodDisruptionBudget (minAvailable: 1 or 2).
  5. IAM & Workload Identity: Workload Identity (iam.gke.io/gcp-service-account) instead of static service account keys.

Next Steps

Once the application is running on GKE:

  • Configure autoscaling — see the gke-workload-scaling skill
  • Set up observability — see the gke-observability skill
  • Harden security — see the gke-workload-security skill
  • Configure reliability (PDBs, topology spread) — see the gke-reliability skill

歷程

v1.0.0 mapping-added 99c871e