简体   繁体   中英

Expose application on kubernetes using nginx ingress controller - baremetal way

I'm new to K8s trying to access the app by IP. Below is the situation -

在此处输入图片说明

  1. Cluster is ready, 1 master node and 1 worker node, pods are with running status
  2. installed nginx ingress controller with help of this doc
  3. now I'm able to access worker node (pasted worker IP on browser which is currently showing 404 status), I want to access the apps running on port 4200 & 8080
  4. How can I access my applications by path based way like XXX.XXX.XXX.XXX/app1 and XXX.XXX.XXX.XXX/app2 , in what files & what changes I have to do? Services are showing status as <pending> ? What does that mean 🧐

If you are using "LoadBalancer" type as the service, obviously you should install or use a 3rd party LoadBalancer, since you're using a BARE-METAL environment. For example you can use MetalLB.

You can find more information regarding MetalLB below: https://blog.inkubate.io/install-and-configure-metallb-as-a-load-balancer-for-kubernetes/

If not, you may have to use "NodePort" type as the service.

Why do you need ingress controller on bare metal?

Try to use simple NodePort service types, it will give you same result. Ingress controller more preferrable when you have it behind cloud load balancer.

Getting back to your question 4:

You can do this only if you have cloud load balancer in front of ingress controller, in any other case you'll have to do something like this: XXX.XXX.XXX.XXX:$INGRESS_CONTROLLER_PORT/$PATH

which refers to: XXX.XXX.XXX.XXX ($K8S_cluster_IP).

And it's almost the same scenario as with NodePort service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM