You can not curl into cluster pods from outside the cluster whose service type i . . .

Deepak Mourya:
https://beta.kodekloud.com/topic/practice-test-imperative-commands-3/ i am using this lab

Vinay:
Hi , Deepak can you check the container port where nginix is running on

Deepak Mourya:
hi @Vinay IPs:
IP: 10.244.0.4
Containers:
nginx:
Container ID: docker://e00b52ae9d97772202d96a3ef5845938504829a7a0d7071536b2045918daad76
Image: nginx
Image ID: docker-pullable://nginx@sha256:6d75c99af15565a301e48297fa2d121e15d80ad526f8369c526324f0f7ccb750
Port: <none>
Host Port: <none>
State: Running
Started: Tue, 22 Jun 2021 14:03:16 +0000
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-9qbwn (ro)

Vinay:
can you edit the Pod port to 8080 and try

    Port: 8080

Deepak Mourya:
hmm ok

Deepak Mourya:
How to set port in the pod ?

Deepak Mourya:
It seems lab session out now :frowning:

Hinodeya:
Its’normally because this ip adress 10.244.0.4:8080 is the ip of the pod

Hinodeya:
You have to create another type of rule --type=NodePort in this case

Hinodeya:
kubectl expose po “name of pod” --type=NodePort --port 8080 target-port 8080 --name svcpodexpose --dry-run -o yaml >svcpo.yaml

Hinodeya:
Edit the yaml and add nodePort: 30087

Deepak Mourya:
I have used the service ip too, but it was not working . If we are using same cluster and same node then why cluster Ip is not working this is what my doubt

Hinodeya:
after that retry curl command with the ip address of the node

Hinodeya:
The current service just working for clusterIp

Deepak Mourya:
Yes nodePort will but i want to test with the cluster IP

Hinodeya:
So use the correct ip address of the node and check who is hosted the pods which node I mean

Hinodeya:
curl -v for deeper informations also

Hinodeya:
good luck

Deepak Mourya:
@Hinodeya Thank you, i have checked these things but unfortunately session is not available right now. :neutral_face:

Navratan Lal Gupta:
@Deepak Mourya as @Vinay pointed you can check if containerPort 8080 is exposed and add it using patch or edit command. U can bot donthat direct on pod I guess. You might need to redeploy new pod. Or if its controlled by object controller you can edit it