Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Ingress nginx baremetal connexion refused

I’am trying to learn kubernetes and ingress. I have misunderstood something ?

I using proxmox with 3vm

     kubectl get nodes
NAME    STATUS   ROLES                  AGE    VERSION
k8sm    Ready    control-plane,master   127d   v1.22.4
k8sn1   Ready    <none>                 127d   v1.22.4
k8sn2   Ready    <none>     

        127d   v1.22.4

I Have 2 nginx pod as a deployment.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

    kubectl get pod
NAME                        READY   STATUS    RESTARTS   AGE
curl-test                   1/1     Running   0          5d11h
frontend-86968456b9-jnbqf   1/1     Running   0          5d11h
frontend-86968456b9-tj2w9   1/1     Running   0          5d11h

1 service used with label

  kubectl get svc
NAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
kubernetes           ClusterIP   10.96.0.1       <none>        443/TCP   127d
my-service-ingress   ClusterIP   10.104.228.72   <none>        80/TCP    25h

svc .yaml

    ---
apiVersion: v1
kind: Service
metadata:
  name: my-service-ingress
spec:
  selector:
    app: frontend
  ports:
  - port: 80
    targetPort: 80

I’m connected to the master node in ssh

 curl http://10.104.228.72
 THIS IS CONTAINER : 1

This is my ingress file copied from officiel kubernetes doc

 apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /frontend
        pathType: Prefix
        backend:
          service:
            name: my-service-ingress
            port:
              number: 80

Ingress ressource:

    kubectl get ingress -o wide
NAME           CLASS    HOSTS   ADDRESS   PORTS   AGE
test-ingress   <none>   *                 80      39m

info about ingress controler

kubectl get all -n ingress-nginx
NAME                                           READY   STATUS      RESTARTS   AGE
pod/ingress-nginx-admission-create--1-tnglj    0/1     Completed   0          24h
pod/ingress-nginx-admission-patch--1-97n79     0/1     Completed   1          24h
pod/ingress-nginx-controller-547f579dc-ssf5r   1/1     Running     0          24h

NAME                                         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/ingress-nginx-controller             NodePort    10.100.181.85   <none>        80:32412/TCP,443:32016/TCP   24h
service/ingress-nginx-controller-admission   ClusterIP   10.98.29.50     <none>        443/TCP                      24h

NAME                                       READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/ingress-nginx-controller   1/1     1            1           24h

NAME                                                 DESIRED   CURRENT   READY   AGE
replicaset.apps/ingress-nginx-controller-547f579dc   1         1         1       24h

NAME                                       COMPLETIONS   DURATION   AGE
job.batch/ingress-nginx-admission-create   1/1           4s         24h
job.batch/ingress-nginx-admission-patch    1/1           5s         24h

curl test with IP nodes don’t work:

kubectl get nodes -o wide
NAME    STATUS   ROLES                  AGE    VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE                       KERNEL-VERSION    CONTAINER-RUNTIME
k8sm    Ready    control-plane,master   127d   v1.22.4   192.168.1.38   <none>        Debian GNU/Linux 10 (buster)   4.19.0-18-amd64   docker://20.10.11
k8sn1   Ready    <none>                 127d   v1.22.4   192.168.1.39   <none>        Debian GNU/Linux 10 (buster)   4.19.0-18-amd64   docker://20.10.11
k8sn2   Ready    <none>                 127d   v1.22.4   192.168.1.40   <none>        Debian GNU/Linux 10 (buster)   4.19.0-18-amd64   docker://20.10.11
rbo@K8sM:~/elearning/kubernestes_admin_course/Zeal_Vora/Ingress$ curl http://192.168.1.39
curl: (7) Failed to connect to 192.168.1.39 port 80: Connexion refusée

>Solution :

In Ingress you have used the path /frontend but you are not hitting it while

Also, use the Node Port with Node IP you are using internal service IP.

Something like :

curl http://192.168.1.39:32412/frontend
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading