Deployment 具有自定义网络的gke集群部署

Deployment 具有自定义网络的gke集群部署,deployment,yaml,google-kubernetes-engine,Deployment,Yaml,Google Kubernetes Engine,我正在尝试创建一个yaml文件,以便在我创建的自定义网络中部署gke集群。我犯了一个错误 接收到JSON有效负载。未知名称“网络”:找不到字段 我尝试了一些资源的名称,但我仍然看到相同的问题 resources: - name: myclus type: container.v1.cluster properties: network: projects/project-251012/global/networks/dev-cloud zone: "us-east4-a"

我正在尝试创建一个yaml文件,以便在我创建的自定义网络中部署gke集群。我犯了一个错误

接收到JSON有效负载。未知名称“网络”:找不到字段

我尝试了一些资源的名称,但我仍然看到相同的问题

resources: - name: myclus type: container.v1.cluster properties: network: projects/project-251012/global/networks/dev-cloud zone: "us-east4-a" cluster: initialClusterVersion: "1.12.9-gke.13" currentMasterVersion: "1.12.9-gke.13" ## Initial NodePool config. nodePools: - name: "myclus-pool1" initialNodeCount: 3 version: "1.12.9-gke.13" config: machineType: "n1-standard-1" oauthScopes: - https://www.googleapis.com/auth/logging.write - https://www.googleapis.com/auth/monitoring - https://www.googleapis.com/auth/ndev.clouddns.readwrite preemptible: true ## Duplicates node pool config from v1.cluster section, to get it explicitly managed. - name: myclus-pool1 type: container.v1.nodePool properties: zone: us-east4-a clusterId: $(ref.myclus.name) nodePool: name: "myclus-pool1" 资源: -姓名:myclus 类型:container.v1.cluster 特性: 网络:projects/project-251012/global/networks/dev cloud 区域:“us-east4-a” 集群: 初始群集版本:“1.12.9-gke.13” 当前主版本:“1.12.9-gke.13” ##初始NodePool配置。 节点工具: -名称:“myclus-pool1” initialNodeCount:3 版本:“1.12.9-gke.13” 配置: 机器类型:“n1-standard-1” oauthScopes: - https://www.googleapis.com/auth/logging.write - https://www.googleapis.com/auth/monitoring - https://www.googleapis.com/auth/ndev.clouddns.readwrite 先发制人:正确 ##从v1.cluster节复制节点池配置,以对其进行显式管理。 -姓名:myclus-pool1 类型:container.v1.nodePool 特性: 地区:us-east4-a clusterId:$(ref.myclus.name) nodePool: 名称:“myclus-pool1”
我希望它将群集节点放置在此网络中。

网络字段需要是群集规范的一部分。顶级属性应仅为
区域
群集
网络
应与initialClusterVersion位于同一缩进处。请参阅

您的清单应该更像:

编辑:API参考文档中关于不推荐的字段存在一些混乱。我提供了一个适用于新API的YAML,而不是您正在使用的API。我已经使用基本v1 API的正确语法进行了更新,并且进一步添加了新的API(目前依赖于gcp类型进行部署)

resources: - name: myclus type: container.v1.cluster properties: projectId: [project] zone: us-central1-f cluster: name: my-clus zone: us-central1-f network: [network_name] subnetwork: [subnet] ### leave this field blank if using the default network initialClusterVersion: "1.13" nodePools: - name: my-clus-pool1 initialNodeCount: 0 config: imageType: cos - name: my-pool-1 type: container.v1.nodePool properties: projectId: [project] zone: us-central1-f clusterId: $(ref.myclus.name) nodePool: name: my-clus-pool2 initialNodeCount: 0 version: "1.13" config: imageType: ubuntu 资源: -姓名:myclus 类型:container.v1.cluster 特性: 项目D:[项目] 地区:us-central1-f 集群: 姓名:我的俱乐部 地区:us-central1-f 网络:[网络名称] 子网:[子网]###如果使用默认网络,请将此字段留空 initialClusterVersion:“1.13” 节点工具: -姓名:my-clus-pool1 initialNodeCount:0 配置: 图像类型:cos -姓名:my-pool-1 类型:container.v1.nodePool 特性: 项目D:[项目] 地区:us-central1-f clusterId:$(ref.myclus.name) nodePool: 姓名:my-clus-pool2 initialNodeCount:0 版本:“1.13” 配置: 图像类型:ubuntu 较新的API(提供更多功能并允许您使用更多功能,包括v1beta1 API和beta功能)的外观如下:

resources: - name: myclus type: gcp-types/container-v1:projects.locations.clusters properties: parent: projects/shared-vpc-231717/locations/us-central1-f cluster: name: my-clus zone: us-central1-f network: shared-vpc subnetwork: local-only ### leave this field blank if using the default network initialClusterVersion: "1.13" nodePools: - name: my-clus-pool1 initialNodeCount: 0 config: imageType: cos - name: my-pool-2 type: gcp-types/container-v1:projects.locations.clusters.nodePools properties: parent: projects/shared-vpc-231717/locations/us-central1-f/clusters/$(ref.myclus.name) nodePool: name: my-clus-separate-pool initialNodeCount: 0 version: "1.13" config: imageType: ubuntu 资源: -姓名:myclus 类型:gcp类型/container-v1:projects.locations.clusters 特性: 父项:项目/shared-vpc-231717/locations/us-central1-f 集群: 姓名:我的俱乐部 地区:us-central1-f 网络:共享专有网络 子网络:仅本地####如果使用默认网络,请将此字段留空 initialClusterVersion:“1.13” 节点工具: -姓名:my-clus-pool1 initialNodeCount:0 配置: 图像类型:cos -姓名:my-pool-2 类型:gcp类型/container-v1:projects.locations.clusters.nodePools 特性: 父项:projects/shared-vpc-231717/locations/us-central1-f/clusters/$(ref.myclus.name) nodePool: 名称:我的俱乐部独立游泳池 initialNodeCount:0 版本:“1.13” 配置: 图像类型:ubuntu 另请注意,您可能需要修改您的作用域,当前的作用域将不允许您从gcr.io提取图像,一些系统吊舱可能无法正常旋转,如果您使用谷歌的存储库,您将无法提取这些图像


最后,您不希望在集群规范和单独中重复节点池资源节点池,对于所有其他节点池,将它们创建为单独的资源来管理它们,而无需经过群集。除了调整大小之外,您可以在节点池上执行的更新非常少。网络字段需要是群集规范的一部分。顶级属性应该是
区域
群集
网络
应与initialClusterVersion位于同一缩进中。请参阅

您的清单应该更像:

编辑:API参考文档中关于不推荐的字段存在一些混乱。我提供了一个适用于新API的YAML,而不是您正在使用的API。我已经使用基本v1 API的正确语法进行了更新,并且进一步添加了新的API(目前依赖于gcp类型进行部署)

resources: - name: myclus type: container.v1.cluster properties: projectId: [project] zone: us-central1-f cluster: name: my-clus zone: us-central1-f network: [network_name] subnetwork: [subnet] ### leave this field blank if using the default network initialClusterVersion: "1.13" nodePools: - name: my-clus-pool1 initialNodeCount: 0 config: imageType: cos - name: my-pool-1 type: container.v1.nodePool properties: projectId: [project] zone: us-central1-f clusterId: $(ref.myclus.name) nodePool: name: my-clus-pool2 initialNodeCount: 0 version: "1.13" config: imageType: ubuntu 资源: -姓名:myclus 类型:container.v1.cluster 特性: 项目D:[项目] 地区:us-central1-f 集群: 姓名:我的俱乐部 地区:us-central1-f 网络:[网络名称] 子网:[子网]###如果使用默认网络,请将此字段留空 initialClusterVersion:“1.13” 节点工具: -姓名:my-clus-pool1 initialNodeCount:0 配置: 图像类型:cos -姓名:my-pool-1 类型:container.v1.nodePool 特性: 项目D:[项目] 地区:us-central1-f clusterId:$(ref.myclus.name) nodePool: 姓名:my-clus-pool2 initialNodeCount:0 版本:“1.13” 配置: 图像类型:ubuntu 较新的API(提供更多功能并允许您使用更多功能,包括v1beta1 API和beta功能)的外观如下:

resources: - name: myclus type: gcp-types/container-v1:projects.locations.clusters properties: parent: projects/shared-vpc-231717/locations/us-central1-f cluster: name: my-clus zone: us-central1-f network: shared-vpc subnetwork: local-only ### leave this field blank if using the default network initialClusterVersion: "1.13" nodePools: - name: my-clus-pool1 initialNodeCount: 0 config: imageType: cos - name: my-pool-2 type: gcp-types/container-v1:projects.locations.clusters.nodePools properties: parent: projects/shared-vpc-231717/locations/us-central1-f/clusters/$(ref.myclus.name) nodePool: name: my-clus-separate-pool initialNodeCount: 0 version: "1.13" config: imageType: ubuntu 资源: -姓名:myclus 类型:gcp类型/container-v1:projects.locations.clusters 特性: 父项:项目/shared-vpc-231717/locations/us-central1-f 集群: 姓名:我的俱乐部 地区:us-central1-f 网络:共享专有网络 子网络:仅限本地###