Reputation: 31
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
curl http://<pod-ip>
but getting timeout. my question is why iam getting timeout ? the same curl command work if execute inside pod. like kubectl exec -it basicpod -- /bin/sh and then inside pod execute curl http://<pod-ip>
Upvotes: 0
Views: 1120
Reputation: 49
Curling inside the cluster it works. create service and expose it then do curl it works fine.
apiVersion: v1
kind: Service
metadata:
name: basicpod-svc
spec:
selector:
type: webserver
type: LoadBalancer
ports:
- nodePort:
port: 80
targetPort: 80
Upvotes: 0
Reputation: 2654
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
Upvotes: 0