在同一Yaml文件中的不同子网中部署节点池

时间:2019-09-20 12:44:11

标签: google-cloud-platform google-kubernetes-engine google-deployment-manager

我正在创建一个yaml配置,以部署具有多节点池的gke集群。我希望能够创建一个新集群并将每个节点池放入一个不同的子网中。能做到吗?

我尝试将子网放在第二个节点池下的属性的不同部分中,但出错了。下面是以下错误。

  

消息:'{“ ResourceType”:“ gcp-types / container-v1:projects.locations.clusters.nodePools”,“ ResourceErrorCode”:“ 400”,“ ResourceErrorMessage”:{“ code”:400,“消息“:“无效       接收到JSON有效负载。未知名称\“子网\”:找不到字段。“,”状态“:” INVALID_ARGUMENT“,”详细信息“:[{” @ type“:” type.googleapis.com/google.rpc.BadRequest","fieldViolations“ :[{“ description”:“无效       接收到JSON有效负载。未知名称\“ subnetwork \”:找不到字段。“}]}],” statusMessage“:”错误

两个节点池的当前代码。创建第一个节点,但出现第二个错误。

resources:
- name: myclus
  type: gcp-types/container-v1:projects.locations.clusters
  properties:
    parent: projects/[PROJECT_ID]/locations/[ZONE/REGION]
    cluster:
      name: my-clus
      zone: us-east4
      subnetwork: dev-web   ### leave this field blank if using the default network
      initialClusterVersion: "1.13"
      nodePools:
      - name: my-clus-pool1
        initialNodeCount: 1
        config:
          machineType: n1-standard-1
          imageType: cos
          oauthScopes:
            - https://www.googleapis.com/auth/cloud-platform
          preemptible: true
- name: my-clus
  type: gcp-types/container-v1:projects.locations.clusters.nodePools
  properties:
    parent: projects/[PROJECT_ID]/locations/[ZONE/REGION]/clusters/$(ref.myclus.name)
    subnetwork: dev-web   ### leave this field blank if using the default
    nodePool:
      name: my-clus-pool2
      initialNodeCount: 1
      version: "1.13"
      config:
        machineType: n1-standard-1
        imageType: cos
        oauthScopes:
          - https://www.googleapis.com/auth/cloud-platform
        preemptible: true

我喜欢预期的结果是在2个不同的子网中有2个节点池。

1 个答案:

答案 0 :(得分:0)

我发现这实际上不是Deployment Manager的限制,而是GKE的限制。

我们无法将不同的子网分配给不同的节点池,网络和子网是在集群级别定义的。节点池API中没有“子网”字段。

这里是link,您可以参考以获取更多信息。

相关问题