skip to Main Content
  1. Created 3 node GKE cluster.

  2. From cmd prompt local logged into gcloud.

  3. 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
  1. 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. like kubectl 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


  1. 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

    Login or Signup to reply.
  2. 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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search