imixs / imixs-cloud

A Lightweight Kubernetes Environment
https://imixs.github.io/imixs-cloud/
GNU General Public License v3.0
200 stars 83 forks source link

Documentation: longhorn UI 002-ingress.yaml?? #56

Closed koo9 closed 3 years ago

koo9 commented 3 years ago

it seems like the file content of 002-ingress.yaml in the longhorn folder is different than that in the doc here. https://imixs.github.io/imixs-cloud/doc/LONGHORN.html

the original 002-ingress.yaml is to create kind: ingress but the doc indicate that its creating kind: IngressRoute.

which is correct?

rsoika commented 3 years ago

Thanks for the hint. 'ingress' is the correct one. I have updated the documentation.

koo9 commented 3 years ago

When tried creating test app whoami, it looks like only IngressRoute works for Traefik. 003-ingress.yaml does not work. it won't add the route to traefik where IngressRoute does. same thing happen for the Traefik setup. in the traefik folder, it uses IngressRoute for setting up the dashboard but not ingress.

I went with IngressRoute for longhorn web ui.

rsoika commented 3 years ago

You are mixing things here. In Kubernetes an "Ingress" is the official object to publish a service. If you have a service defined you can add an ingress definition like this:

kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
  name: my-tls
  namespace: my-namespace
spec:
  rules:
  - host: myapp.foo.com
    http:
      paths:
      - path: /
        backend:
          serviceName: myservcie
          servicePort: 8080

Traefik is the reverse proxy managing the routing. If you do not have Traefik you need to install some other service (e.g. ngix)

Traefik itself has a Web UI. But this web UI must be configured via "IngressRoute". This is a traefik specific object and not a kubernetes standard!

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
...........

I think the IngressRoute is the only object that will do the trick to access the trafic-ui via web browser. This is why I use a different setup here.

For all other services you should use the core 'Ingress' object. If this does not work, than you can open the Traefik UI and see what is going wrong. Also it may be helpful to check the logfiles from your traefik service.

So first try to get the whoami example working. This is a kind of smoke-test for your cluster.

Longhorn is the next stage.....

koo9 commented 3 years ago

yes, so by using traefik as the reverse proxy, all service need to go through traefik in order to get a proper route, not?

rsoika commented 3 years ago

yes. Traefik tells kubernetes to do it in this way.

koo9 commented 3 years ago

since lmix-cloud uses traefik that means all ingress route should use the traefik ingressroute object instead of the standard ingress object. is my understanding correct?

rsoika commented 3 years ago

no, you should use ingeress because this is the standard way. Do not think to much about the ingresRoute which is a special traefik object. I use it for the traefik web-ui only. If you find out a way how the traefik web-ui itself can be routed via a normal ingress object that would be great.

Take also a look into this discussion on stackoverflow. It may clarify things.

koo9 commented 3 years ago

then how could ingress work if using traefik?

koo9 commented 3 years ago

saw that discussion in stavkovetflow. do I thought if not using ingressroute, traefik would not route the request properly

koo9 commented 3 years ago

I guess we are talking about the same thing but different idea. yes ingress would work internally but we are building a picture that will be exposed outside of the cluster so must of through traefik.

rsoika commented 3 years ago

For an internal communication between services and pods you do not need a reverse proxy in kubernetes. The kubernetes network is responsible for internal communication and routing.

The reason why you use a reverse proxy like traefik or ngnix is to expose a service to outside the cluster via a public DNS name. This is the idea of 'ingress'. An ingress is an entry-point to access a service from outside you cluster.

traefik provides you with a bunch of functionality to do this in many ways. They have their own technology called "IngressRoute" but of course they support also the kubernetes 'Ingress' concept.

In other words:

I really would like to help you. But I do no loner understand what you are asking me?

koo9 commented 3 years ago

my original question was with traefik, ingressroute works but not ingress. because when tried creating route for Longhorn ui or who am I with ingress, it does not work.

I have multiple domains pointing to a single public ip so a reverse proxy is required to route the traffic with domain name header in the request.

rsoika commented 3 years ago

Have you checked the log files form traefik and also the traefik Web UI can give you a hint if all your services are configured the right way (config errors are shown in the dashboard)

koo9 commented 3 years ago

with ingressroute, Longhorn ui and whoami works fine but if I use ingress they won't work.

rsoika commented 3 years ago

Hm, I wonder what is going wrong in your setup. Can you please post your current whoami ingresRoute definition. I just want to understand why ingress did not work for you.

In this document we explain both configuration types - ingress and ingressRoute. Both should work. And the whoami example code is based on ingress. So did you have written your own ingress configuration?

If you open your traefik dashboard you should see if something is going wrong in the 'errors' section:

image

If you click on "http -> http services" you should see your services and how they are connected:

image

the kubernetes icon on the right column indicates that it is a service running via 'Ingress' and a traefik icon indicates that it is working via the internal api

Of course both configuration should work at the end. But I think configuration of Traefik IngressRoute is more complex than the kubernetes Ingress Object.

Can you give me more information how your setup is working? I want to better understand your problem. Maybe other users run into the same problem.....

koo9 commented 3 years ago

all routes are working with IngressRoute.

this does not work as it won't register a route with traefik.

IngresRoute http


kind: Ingress apiVersion: networking.k8s.io/v1beta1 metadata: name: myingress spec: rules:

this works:

IngresRoute http


kind: IngressRoute apiVersion: traefik.containo.us/v1alpha1 metadata: name: whoami-notls spec: routes:


From: Ralph Soika notifications@github.com Sent: December 22, 2020 1:59 PM To: imixs/imixs-cloud imixs-cloud@noreply.github.com Cc: Kevin koo9@hotmail.com; Author author@noreply.github.com Subject: Re: [imixs/imixs-cloud] Documentation: longhorn UI 002-ingress.yaml?? (#56)

Hm, I wonder what is going wrong in your setup. Can you please post your current whoami ingresRoute definition. I just want to understand why ingress did not work for you.

In this documenthttps://github.com/imixs/imixs-cloud/blob/master/doc/INGRESS.md we explain both configuration types - ingress and ingressRoute. Both should work. And the whoami example code is based on ingress. So did you have written your own ingress configuration?

If you open your traefik dashboard you should see if something is going wrong in the 'errors' section:

[image]https://user-images.githubusercontent.com/1339124/102932087-efe23400-449f-11eb-8595-b359a92c17e5.png

If you click on "http -> http services" you should see your services and how they are connected:

[image]https://user-images.githubusercontent.com/1339124/102932289-48193600-44a0-11eb-9325-b39ab35326d3.png

the kubernetes icon on the right column indicates that it is a service running via 'Ingress' and a traefik icon indicates that it is working via the internal api

Of course both configuration should work at the end. But I think configuration of Traefik IngressRoute is more complex than the kubernetes Ingress Object.

Can you give me more information how your setup is working? I want to better understand your problem. Maybe other users run into the same problem.....

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/imixs/imixs-cloud/issues/56#issuecomment-749773168, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACAIEERRNXAQ7F6JQOAWYYTSWECCFANCNFSM4VDOACJA.

rsoika commented 3 years ago

I am closing this now. You need to learn how to question in the open source community. 'this does not work ' is not helpful and in that way you are just wasting others people time.
As IngressRoute works for you got ahead with that configuration.

koo9 commented 3 years ago

@rsoika sorry about not explaining the problem clear enough. what I mean was when using Ingress, traefik did not register the route but with ingressroute, traefik registered the route properly.

rsoika commented 3 years ago

But in such a case traefik should print some information into its log file. That can be helpful.

koo9 commented 3 years ago

btw really appreciate your help. all your yaml files save me so much learning time! I am new to kubernetes and coming from the docker swarm background, it's quite a bit of changes.

rsoika commented 3 years ago

I started also from docker swarm. Kubernetes has a really steep learning curve. But after as while things become more and more clear. And kubernetes provides you with a lot of powerful possibilities to build your app environment.

koo9 commented 3 years ago

@rsoika yup. now I have making much better progress. basically migrated the apps from docker swarm. traefik has good support for websocket so not so much struggle there but there are still a lot to learn. I like kubernetes a lot

rsoika commented 3 years ago

I now started to switch form traefik to NGNIX. The NGINX Controller project is maintained by the kuberentes team and it seems much more easy to use. It simplifies a lot:

https://github.com/imixs/imixs-cloud/blob/master/doc/INGRESS.md

koo9 commented 3 years ago

does it have the same support for websocket?

rsoika commented 3 years ago

I don't know