Welcome to the Linux Foundation Forum!

Exercise 8.2 - Not able to do a curl using NodePort

Posts: 15
edited August 2020 in LFS258 Class Forum

Hi,

  1. ubuntu@ip-172-31-32-211:~$ kubectl -n accounting describe services
  2. Name: service-lab
  3. Namespace: accounting
  4. Labels: system=secondary
  5. Annotations: <none>
  6. Selector: system=secondary
  7. Type: NodePort
  8. IP: 10.104.115.79
  9. Port: <unset> 8080/TCP
  10. TargetPort: 8080/TCP
  11. NodePort: <unset> 31742/TCP
  12. Endpoints: 192.168.89.54:8080,192.168.89.55:8080
  13. Session Affinity: None
  14. External Traffic Policy: Cluster
  15. Events: <none>
  16. ubuntu@ip-172-31-32-211:~$ kubectl cluster-info
  17. Kubernetes master is running at https://k8smaster:6443
  18. KubeDNS is running at https://k8smaster:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
  19.  
  20. To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
  21. ubuntu@ip-172-31-32-211:~$ curl https://k8smaster:31742
  22. curl: (7) Failed to connect to k8smaster port 31742: Connection refused
  23. ubuntu@ip-172-31-32-211:~$ curl http://k8smaster:31742
  24. curl: (7) Failed to connect to k8smaster port 31742: Connection refused

Also, I see in the description that "In a previous exercise we deployed a Load Balancerwhich deployed a ClusterIP and NodePort automatically."
IIRC, In Exercise 8.1 we do not deploy a LB Service. Please correct me if I am wrong.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Comments

  • Posts: 1,000

    Hello,

    It would look like the service is as expected, so next I would want to make sure the pod is properly running. Just to double-check you have no firewalls in place, and the nodes have 2cpu/7.5G? This is what I would try next:

    Check the spelling of the labels, it is case sensitive. Are both the service and the pod using "system=secondary"? The service must match what you set Ex8.1, step 1.

    kubectl get pods -o wide --all-namespaces
    kubectl -n accounting get svc
    kubectl describe node | grep -i taint

    As far as the LB setup, the description says "a previous lab", which may be prior to 8.1. For example Ex3.5, step 5.

    Regards,

  • Posts: 2,451

    Hi @ganeshahv,

    As long as the Service's TargetPort is set to 8080, it will not be able to forward traffic to the port 80 of the nginx container.

    I suggest reconfiguring the service and/or the yaml manifest of the nginx-one Deployment - which should be performed in step 13 of exercise 8.1.

    Regards,
    -Chris

  • Hi @chrispokorni , thanks for your suggestion. I reconfigured the services and it works fine now.

    `Name: service-lab
    Namespace: accounting
    Labels: system=secondary
    Annotations:
    Selector: system=secondary
    Type: NodePort
    IP: 10.99.38.30
    Port: 80/TCP
    TargetPort: 80/TCP
    NodePort: 32204/TCP
    Endpoints: 192.168.89.62:80,192.168.89.63:80
    Session Affinity: None
    External Traffic Policy: Cluster
    Events:
    ubuntu@ip-172-31-32-211:~$ curl http://k8smaster:32204
    <!DOCTYPE html>


    Welcome to nginx!

    body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; }


    Welcome to nginx!

    If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

    For online documentation and support please refer to nginx.org.
    Commercial support is available at nginx.com.

    Thank you for using nginx.



    ubuntu@ip-172-31-32-211:~$`

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training