用途:创建生产可用的 GKE 集群,指导完成架构、网络与安全配置,包括集群创建、模式选择、网络设置和初始资源配置。触发场景包括“create GKE cluster”“set up Kubernetes cluster”“Autopilot vs Standard”“configure GKE networking”。
主要能力与流程:
- 模式选择:Autopilot 适合无状态、可扩缩的 Spring Boot 微服务,由 Google 管理节点与安全,按 Pod 计费;Standard 适合需要完全控制节点配置、自定义内核或特权容器的场景。资料建议多数新部署用 Autopilot。
- 集群类型:区域集群用于生产(控制平面跨多可用区);可用区集群仅用于非关键环境。
- 网络:生产集群要求 VPC 原生,需指定 network、subnetwork、--enable-ip-alias 及 Pods/Services 次级 IP 范围。
- 安全:可启用私有节点、私有端点、主节点授权网络,Workload Identity 与 Shielded Nodes 默认启用。
- 节点池:仅 Standard 需创建专用节点池,支持自动扩缩(min/max nodes)与 Spot 实例。
- 监控日志:启用 Cloud Logging、Cloud Monitoring 和 Managed Prometheus。
- 获取凭据并验证:gcloud container clusters get-credentials,再用 kubectl cluster-info、kubectl get nodes 验证。
关键命令示例:Autopilot 使用 gcloud container clusters create-auto CLUSTER_NAME --region=europe-west2 --enable-ip-alias;Standard 使用 gcloud container clusters create CLUSTER_NAME --region=europe-west2 --enable-ip-alias --machine-type=n2-standard-4 --num-nodes=3。
要求:已配置 gcloud CLI 与权限;启用 GKE API(gcloud services enable container.googleapis.com);VPC 与子网(含次级 IP 范围)已创建;私有集群需配置授权网络;IAM 角色 roles/container.admin 或 roles/container.clusterManager。
限制:资料未提供收费与价格细节,仅提及 Autopilot 按 Pod 计费和 Spot 更便宜等描述;未提供跨平台替代方案或具体 SLA 之外的其他指标。相关技能包括 Workload Identity、部署策略与故障排查。