[英]Cannot access Load Banalcer IP from Google Cloud Shell after creating GKE Cluster
I am learning GKE services and have created a GKE cluster
with below information我正在学习 GKE 服务并创建了一个包含以下信息的
GKE cluster
$ gcloud container clusters list
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
mycluster us-east1-b 1.14.10-gke.27 35.X.X.X n1-standard-1 1.14.10-gke.27 3 RUNNING
I created my own VPC subnet
with below range which I assigned to the cluster.我创建了自己的
VPC subnet
,其范围低于我分配给集群的范围。
IP address range : 10.7.0.0/24
The below secondary IP range was assigned by GKE engine以下辅助 IP 范围由 GKE 引擎分配
Secondary IP range
gke-mycluster-pods-765b8f97 10.44.0.0/14
gke-mycluster-services-765b8f97 10.237.0.0/20
After creating the cluster the node information is as follows:创建集群后节点信息如下:
$kubectl get nodes
NAME STATUS ROLES AGE VERSION
gke-mycluster-default-pool-c2ddd83e-km5k Ready <none> 21m v1.14.10-gke.27
gke-mycluster-default-pool-c2ddd83e-trrl Ready <none> 21m v1.14.10-gke.27
gke-mycluster-default-pool-c2ddd83e-x4w3 Ready <none> 21m v1.14.10-gke.27
My deployment YAML is as follows which creates a nginx container:我的部署 YAML 如下创建一个 nginx 容器:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mywebapp-replicaset
labels:
app: mywebapp
type: front-end
spec:
template:
metadata:
name: myngix-pod
labels:
app: mywebapp
type: front-end
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
replicas: 3
selector:
matchLabels:
type: front-end
Below is my service definition以下是我的服务定义
apiVersion: v1
kind: Service
metadata:
name: mywebapp-services
labels:
app: mywebapp
type: front-end
spec:
type: LoadBalancer
ports:
- targetPort: 80
port: 80
selector:
app: mywebapp
type: front-end
After creating the service using kubectl command, it looks like this使用 kubectl 命令创建服务后,它看起来像这样
$ kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.237.0.1 <none> 443/TCP 23h
mywebapp-services LoadBalancer 10.237.12.141 <pending> 80:31102/TCP 6s
Now if I try to access the LoadBalancer IP
from Gcloud shell
it is timing out, am I missing something现在,如果我尝试从
Gcloud shell
访问LoadBalancer IP
它超时,我错过了什么
$ curl http://10.237.12.141:80
curl: (7) Failed to connect to 10.237.12.141 port 80: Connection timed out
The address 10.xxx is a private IPv4 address in your VPC.地址 10.xxx 是您的 VPC 中的私有 IPv4 地址。 Cloud Shell is not running in your VPC.
Cloud Shell 未在您的 VPC 中运行。 Therefore the address is not reachable.
因此无法访问该地址。 You must use the External IP.
您必须使用外部 IP。
For more information about private IPv4 addresses:有关私有 IPv4 地址的更多信息:
Private IPv4 addresses 私有 IPv4 地址
There are also private IPv6 addresses.还有私有 IPv6 地址。 Google Cloud VPCs do not support IPv6.
Google Cloud VPC 不支持 IPv6。 Some Google Cloud services such as HTTP(S) Load Balancers do support IPv6 but these resources are not part of your project's VPCs.
某些 Google Cloud 服务(例如 HTTP(S) 负载均衡器)确实支持 IPv6,但这些资源不属于您项目的 VPC。
VPC networks only support IPv4 unicast traffic.
VPC 网络仅支持 IPv4 单播流量。 They do not support broadcast, multicast, or IPv6 traffic within the network;
它们不支持网络内的广播、多播或 IPv6 流量; VMs in the VPC network can only send to IPv4 destinations and only receive traffic from IPv4 sources.
VPC 网络中的虚拟机只能发送到 IPv4 目标,并且只能接收来自 IPv4 源的流量。 However, it is possible to create an IPv6 address for a global load balancer.
但是,可以为全局负载均衡器创建 IPv6 地址。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.