Giter Club home page Giter Club logo

Comments (38)

r4j4h avatar r4j4h commented on August 28, 2024 1

Incase it is not from the security context, are you using CNI for your cluster? If so the hostPort entries are ignored right now by CNI implementations (see this issue). If that is indeed your problem, try hostNetworking: true to make the container use the host's network instead of just the ports. This works in the meantime over CNI.

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024 1

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024 1

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo
My apologies for the delayed response. From my understanding, this file is used to deploy the controller https://github.com/fabric8io/fabric8-devops/blob/master/ingress-nginx/src/main/fabric8/deployment.yml As you can see, ports 80 and 443 on the container are mapped to ports 80 and 443 on the host machine. NGINX can't start probably because one or both of those ports are taken by some other application or a container running on that machine.

Unfortunately, we don't report the exact error when NGINX isn't able start. This will be fixed.

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo

I try to check what's using these ports. I have another question related to
this. my servers are running on private Env. so I need proxy to connect to
Internet. I configured all applications on these servers to use this proxy
(docker, curl..etc). does NGINX needs to be configured to use this proxy as
well?

NGINX doesn't require outbound Internet connectivity so there's no need to configure it for NGINX.

also I checked these two ports 80 and 443 and they not being used on the
server.

I think it's the issue when your Kubernetes environment doesn't allow to create containers that expose privileged ports on the host. Could you try to add

   securityContext:
      privileged: true

to the NGINX deployment yaml file and then redeploy the controller, similar to https://github.com/nginxinc/kubernetes-ingress/pull/53/files ?

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo
securityContext must be put one level up into the Container spec, not the Port spec.

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo

NGINX returns the bad gateway error when there is no healthy upstream servers available. Please double check that the containers of the service you are exposing via NGINX are successfully created and running properly. Checking the controller logs also night help to determine the problem.

Additionally, I suggest to try to use the latest version of the controller, which is nginxdemos/nginx-ingress:0.6.0

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo
Could you also list Ingress resources?

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo The problematic one is http://fabric8.default.10.103.12.20.nip.io ?

Could you do the following:

$ kubectl get -o yaml ing fabric8
$ kubectl describe svc fabric8

Could you also looks through NGINX logs and find the generated config related to the fabric8 ingress?

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo The generated configuration looks good.

When you get the 502 error, could you past the related log entry from the NGINX logs?
Could you connect to the pod, install curl and try to connect to any of the endpoints?

$ kubectl exec <nginx-pod> -it -- bash
# apt-get update -y
# apt-get install -y curl
# curl http://172.16.87.3:9090

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo Could you setup kubectl to bypass the squid proxy when connecting to the API server?

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo
In your case, kubectl using a proxy to connect to the API server, which resides on the same host from my understanding, so using a proxy for that isn't necessary. Could make it bypass the proxy temporary?

Also, could you try to run the commands like below fist and see if they will work:

$ kubectl exec <nginx-pod> -- apt-get update -y
...

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo
Could you try to connect to any of the servers like http://fabric8.default.10.103.12.20.nip.io and then find the error in the NGINX logs? It will tell why NGINX couldn't connect to the endpoint.

This might work to bypass the proxy: $ HTTPS_PROXY='' kubectl exec ...

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo

so from above nginx did the correct mapping but it cant reach the server
itself?

That's correct

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo That's great that you found out the root cause. I'm not sure If I can help

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo
The Ingress controller is deployed on the nodes with the following label -- fabric8.io/externalIP: true -- according to https://github.com/fabric8io/fabric8-devops/blob/master/ingress-nginx/src/main/fabric8/deployment.yml It looks like in your case there are no nodes with that label. You can check it by running kubectl get nodes -l fabric8.io/externalIP=true. Not sure why those labels are not assigned to the nodes as I'm not familiar with the fabric8 installation.

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo

[root@centos-master ~]# telnet 0 80

Are you sure that the controller is running on the master node?

Could you also add the hostNetwork: true to the Pod spec of the controller and see if that helps?

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

fattahmahran avatar fattahmahran commented on August 28, 2024

from kubernetes-ingress.

pleshakov avatar pleshakov commented on August 28, 2024

@abdoo
Sorry for the confusion. By the controller I meant the NGINX Ingress controller.
Could you change its deployment by adding hostNetwork: true to the Pod spec?

from kubernetes-ingress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.