-
Created 3 node GKE cluster.
-
From cmd prompt local logged into gcloud.
-
Created a pod with nginx container and exposed port 80
apiVersion: v1 kind: Pod metadata: name: basicpod labels: type: webserver spec: containers: - name: webcont image: nginx ports: - containerPort: 80
- Now trying to do curl command
curl http://<pod-ip>
but getting timeout. my question is why iam getting timeout ? the same curl command work if execute inside pod. likekubectl exec -it basicpod -- /bin/sh and then inside pod execute curl http://<pod-ip>
GKE cluster details:
Networking
Private cluster Disabled
Network default
Subnet default
VPC-native traffic routing Disabled
Cluster pod address range (default) X.X.X.X/X
Service address range X.X.X.X/X
Intranode visibility Disabled
NodeLocal DNSCache Disabled
HTTP Load Balancing Enabled
Subsetting for L4 Internal Load Balancers Disabled
Control plane authorized networks
Disabled
Network policy Disabled
Dataplane V2 Disabled
Security
Binary authorization Disabled
Shielded GKE nodes Enabled
Confidential GKE Nodes Beta Disabled
Application-layer secrets encryption Disabled
Workload Identity Disabled
Google Groups for RBAC Disabled
Legacy authorization Disabled
Basic authentication
Disabled
Client certificate Disabled
2
Answers
Curling from inside cluster should work, curling from outside (browser as an example) you need to make sure firewalls are set up. + you need to expose the service through a LB as an example
Curling inside the cluster it works. create service and expose it then do curl it works fine.