我正在尝试使用“自定义”类型网络启动GKE群集,而不是“自动”类型网络 .
我使用以下命令启动我的集群:
$ gcloud container clusters create --cluster-ipv4-cidr=10.0.0.0/14 --network=ttest --subnetwork=ttest --num-nodes=1 jt
我收到以下错误:
Creating cluster jt...done.
ERROR: (gcloud.container.clusters.create) Operation [<Operation
name: u'operation-1467037655793-e319dc5e'
operationType: OperationTypeValueValuesEnum(CREATE_CLUSTER, 1)
selfLink: u'https://container.googleapis.com/v1/projects/TRUNCATED/zones/us-east1-b/operations/operation-1467037655793-e319dc5e'
status: StatusValueValuesEnum(DONE, 3)
statusMessage: u'Requested CIDR 10.0.0.0/14 is not available in network "ttest".'
targetLink: u'https://container.googleapis.com/v1/projects/TRUNCATED/zones/us-east1-b/clusters/jt'
zone: u'us-east1-b'>] finished with error: Requested CIDR 10.0.0.0/14 is not available in network "ttest".
它似乎想要一个具有 /14
地址范围的网络或子网,因此该命令应该理想地工作,但事实并非如此 .
这很奇怪,因为这是我的网络的样子:
ttest网络:
$ gcloud compute networks describe ttest
autoCreateSubnetworks: false
creationTimestamp: '2016-06-27T07:25:03.691-07:00'
id: '5404409453117999568'
kind: compute#network
name: ttest
selfLink: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/ttest
subnetworks:
- https://www.googleapis.com/compute/v1/projects/myproject/regions/us-east1/subnetworks/ttest
x_gcloud_mode: custom
ttest子网:
$ gcloud compute networks subnets describe ttest
creationTimestamp: '2016-06-27T07:25:21.649-07:00'
gatewayAddress: 10.0.0.1
id: '6237639993374575038'
ipCidrRange: 10.0.0.0/14
kind: compute#subnetwork
name: ttest
network: https://www.googleapis.com/compute/v1/projects/myproject/global/networks/ttest
region: https://www.googleapis.com/compute/v1/projects/myproject/regions/us-east1
selfLink: https://www.googleapis.com/compute/v1/projects/myproject/regions/us-east1/subnetworks/ttest
我尝试使用 --range=10.0.0.0/8
手动创建的旧网络,然后尝试在该网络中创建一个群集,这似乎也不起作用 .
似乎/ 14规则被硬编码到某个地方的GKE配置中,但我真的不知道自定义网络中想要启动容器的内容 .
GKE容器启动命令适用于模式/类型为"auto".的任何网络
我对任何与我相关的文件都很仔细,但没有太多运气 . 唯一突出this page的以下片段:
将子网与其他产品一起使用时存在以下限制:Google托管虚拟机:仅在自动子网网络上受支持 . 无法部署在自定义子网中 .
GKE是否使用托管虚拟机?是什么导致了这个问题?
1 回答
GKE确实支持自定义子网 . 您遇到的问题是GKE强制
cluster-ipv4-cidr
范围与VM可能从中分配IP的所有子网不相交,因为这会导致数据包应在内部网络上路由的模糊性 .cluster-ipv4-cidr
确定应将哪些CIDR范围用于群集中的容器,而使用的子网确定哪些IP地址用于在该网络中创建的所有VM .要解决此问题,只需在gcloud命令中停止指定
--cluster-ipv4-cidr
标志即可 . 然后GKE将为您选择一个安全的cluster-ipv4-cidr
范围 .