You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求提供GCP中通过Deployment Manager创建容器集群的YAML参考

Got it, let's help you out with that! Below is a practical YAML configuration for creating a Google Kubernetes Engine (GKE) cluster using Cloud Deployment Manager, plus breakdowns of key sections to make customization easier.

GKE Cluster Deployment Manager YAML Example
imports:
- path: container.v1.cluster
- path: container.v1.nodePool

resources:
- name: my-gke-cluster
  type: container.v1.cluster
  properties:
    zone: us-central1-a
    cluster:
      name: my-gke-cluster
      initialNodeCount: 2
      nodeConfig:
        machineType: e2-medium
        oauthScopes:
        - "https://www.googleapis.com/auth/cloud-platform"
        diskSizeGb: 30
        diskType: pd-standard
      network: default
      subnetwork: default
      enableKubernetesAlpha: false
      enableIpAlias: true
      releaseChannel:
        channel: REGULAR

- name: my-additional-node-pool
  type: container.v1.nodePool
  properties:
    zone: us-central1-a
    cluster: $(ref.my-gke-cluster.name)
    nodePool:
      name: additional-pool
      initialNodeCount: 1
      config:
        machineType: e2-highmem-2
        diskSizeGb: 50
        oauthScopes:
        - "https://www.googleapis.com/auth/cloud-platform"
      autoscaling:
        enabled: true
        minNodeCount: 1
        maxNodeCount: 3
Key Customization Notes
  • Basic Cluster Settings: Adjust the zone, initialNodeCount, and machineType to match your region/resource needs. The releaseChannel lets you control how GKE updates your cluster (REGULAR, RAPID, or STABLE).
  • Node Config: The oauthScopes define the permissions your nodes have—cloud-platform gives full access, but you can restrict this to specific scopes like compute-rw or storage-ro for better security.
  • IP Aliasing: enableIpAlias: true enables VPC-native clusters, which is recommended for most modern GKE setups.
  • Additional Node Pools: The second resource shows how to add a dedicated node pool with autoscaling. This is useful for workloads that need different machine types or scaling rules.
Validation & Deployment Tips
  • Before deploying, validate your config with:
    gcloud deployment-manager deployments validate --config cluster-config.yaml
    
  • To create the deployment:
    gcloud deployment-manager deployments create my-cluster-deployment --config cluster-config.yaml
    
  • If you need to add more features like private clusters, node taints, or pod security policies, you can extend the cluster or nodePool properties with the corresponding fields from the GKE API specs.

内容的提问来源于stack exchange,提问作者Ram

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:24:26