也可以选择 其他方法 来实现 Kubernetes 网络模型。
复制 for instance in worker-0 worker-1 worker-2 ; do
gcloud compute instances describe ${instance} \
--format 'value[separator=" "](networkInterfaces[0].networkIP,metadata.items[0].value)'
done
复制 10.240.0.20 10.200.0.0/24
10.240.0.21 10.200.1.0/24
10.240.0.22 10.200.2.0/24
复制 for i in 0 1 2 ; do
gcloud compute routes create kubernetes-route-10-200- ${i} -0-24 \
--network kubernetes-the-hard-way \
--next-hop-address 10.240.0.2 ${i} \
--destination-range 10.200. ${i} .0/24
done
复制 gcloud compute routes list --filter "network: kubernetes-the-hard-way"
复制 NAME NETWORK DEST_RANGE NEXT_HOP PRIORITY
default-route-6be823b741087623 kubernetes-the-hard-way 0.0.0.0/0 default-internet-gateway 1000
default-route-cebc434ce276fafa kubernetes-the-hard-way 10.240.0.0/24 kubernetes-the-hard-way 0
kubernetes-route-10-200-0-0-24 kubernetes-the-hard-way 10.200.0.0/24 10.240.0.20 1000
kubernetes-route-10-200-1-0-24 kubernetes-the-hard-way 10.200.1.0/24 10.240.0.21 1000
kubernetes-route-10-200-2-0-24 kubernetes-the-hard-way 10.200.2.0/24 10.240.0.22 1000