I am learning GKE services and have created a GKE cluster
with below information
$ 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 .
IP address range : 10.7.0.0/24
The below secondary IP range was assigned by GKE engine
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:
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 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
$ 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.x.x.x is a private IPv4 address in your VPC. Cloud Shell is not running in your VPC. Therefore the address is not reachable. You must use the External IP.
For more information about private IPv4 addresses:
There are also private IPv6 addresses. Google Cloud VPCs do not support 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.
VPC networks only support IPv4 unicast traffic. They do not support broadcast, multicast, or IPv6 traffic within the network; VMs in the VPC network can only send to IPv4 destinations and only receive traffic from IPv4 sources. However, it is possible to create an IPv6 address for a global load balancer.