Welcome to the Linux Foundation Forum!

Lab 2.3 create a basic pod - cannot connect to pod via CLUSTER IP

So I am using Ubuntu 20.04, not 18.04. Everything working great but for lab 2.3, step 11, if I try to access to the web server using the CLUSTER-IP for the basicservice, I get a connection time out:

curl: (7) Failed to connect to 10.99.248.201 port 80: Connection refused

Now if I try to hit the pod directly by its IP, I get expected result.

ubuntu@my-master-node:~$ kubectl get svc
NAME           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
basicservice   NodePort    10.99.248.201   <none>        80:32489/TCP   2m58s
kubernetes     ClusterIP   10.96.0.1       <none>        443/TCP        29m

ubuntu@my-master-node:~$ curl http://10.99.248.201
curl: (7) Failed to connect to 10.99.248.201 port 80: Connection refused

ubuntu@my-master-node:~$ kubectl get pod -o wide
NAME       READY   STATUS    RESTARTS   AGE   IP                NODE             NOMINATED NODE   READINESS GATES
basicpod   1/1     Running   0          21s   192.168.208.194   ip-172-31-36-1   <none>           <none>

ubuntu@my-master-node:~$ curl http://192.168.208.194
<!DOCTYPE html>
[...]

Comments

  • If you're using aws or gcp, make sure your security group & vpc nacl (aws)/firewall rule (gcp) isn't blocking the request to your cluster ip. I had this issue until I added a firewall rule to allow all traffic from all src ips. (0.0.0.0/0) Of course you can tighten these up but it's a quick way to see if that's the root cause.

  • Hi and thanks for your comment. I have checked all that and it's all open.

  • I'm not sure I understand what that IP is anyway? I understand hitting the POD through its IP (and it's running on the other node) and that';s working fine, but what's the basic service IP for ?

  • Never mind, I went through basic.yaml and basicservice.yaml and I got some lines wrong. All working now

  • Hi @bendubuisson , I am facing the same issue. Could you please let me know what helped you to fix the issue?

  • Never mind, had missed a few configs, got it.

Categories

Upcoming Training