skip to Main Content

I am not able to access the nginx server using http://:30602 and also http://:30602

OS: Ubuntu 22

I also checked if any firewall is blocking it.

Using ufw

admin@tst-server:~$ sudo ufw status verbose
Status: inactive

Using netstat

admin@tst-server:~$ netstat -an | grep 22 | grep -i listen
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
unix  2      [ ACC ]     STREAM     LISTENING     354787   /run/containerd/s/9a866c6ea3a4fe1976aaed0884400cd59228d43776774cc3fad2d0b9a7c2ed7b
unix  2      [ ACC ]     STREAM     LISTENING     21722    /run/systemd/private
admin@tst-server:~$ netstat -an | grep 30602 | grep -i listen

Commands used for nginx deployment

Create Deployment

kubectl create deployment nginx --image=nginx
kubectl get deployments
NAME    READY   UP-TO-DATE   AVAILABLE   AGE
myapp   2/2     2            2           8d
nginx   1/1     1            1           9m50s

Create Service

kubectl create service nodeport nginx --tcp=80:80
kubectl get svc
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1        <none>        443/TCP        8d
nginx        NodePort    10.109.112.116   <none>        80:30602/TCP   10m

Test it out

admin@tst-server:~$ hostname
tst-server.com

admin@tst-server:~$ curl tst-server.com:30602
curl: (7) Failed to connect to tst-server.com port 30602 after 10 ms: Connection refused

2

Answers


  1. Chosen as BEST ANSWER

    Got it working by getting the Node IP address for Minikube using following command

    $ kubectl cluster-info
    

    and then

    curl  http://<node_ip>:30008
    

  2. Upon curl test-server.com:30602 why it redirects to tst-server.kanaaritech.com?
    To check whether the node port is working or not you can check once with the node’s IP with port 30602.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search