Which matcher should I use for a service, hosted on localhost {port} for a local Service Fabric cluster

送分小仙女□ 提交于 2019-12-13 03:46:36

问题


I have a question regarding Service Fabric and Traefik.

I have managed to succesfully deploy the Traefik application to a local cluster (and actually out in my own Azure Infra too). This is alongside a service (MyService) in another application I am trying to have Traefik (RP) sit in front of.

I can see the Traefik dashboard, and I can see a backend (seemingly indicating that it has succesfully called the SF management API correctly for my application and service).

I can also see an accompanying frontend, with some routing rules (matchers). However, for the life of me, I can't get a simple request through the RP to my service.

I can hit my service directly. Service Fabric (SF) says it's in a good state also.

My local SF cluster isn't secured, so that simplifies things somewhat with .toml set up, etc.

My Service is hosted on localhost:9025 (endpoint is exposed in the service manifest and port set up (Kestrel in API)) the same too.

Traefik is set up on port 5000 (as opposed to 80 - see below).

To hit a simple version check, explicitly, I would use http://localhost:9025/myservice/myaction/v1/version

Doing http://localhost:5000/myservice/myaction/v1/version gets me either a 404 or 503 (depending on what I'm doing with matcher/modifier).

I have modified the Traefik endpoint from port 80 to 5000 too, just to switch it up and avoid any port conflicts. (I dont have an IIS sites up as it stands.) Netstat confirms that no other port is being used either.

The matcher in the Service Manifest looks like this:

             <Extensions>
                <Extension Name="Traefik">
                    <Labels xmlns="http://schemas.microsoft.com/2015/03/fabact-no-schema">
                        <Label Key="traefik.frontend.rule">PathPrefix:/myservice</Label>
                        <Label Key="traefik.enable">true</Label>
                    </Labels>
                </Extension>
```            </Extensions>

One last thing, I guess, that would have really helped would be the ability to see the "resolved" requests.  That is a request that comes into the RP, and then is matched or modified so that I can see what the RP actually reconciles a request out too. Perhaps this already exists, but tweaking of various logging didn't yield this info.

回答1:


Ok, So there is nothing wrong with the Service Manifest relating to Traefik, but rather its the exposure of the Endpoint in the Manifest which is not understood by Traefik.

This won't work:

<Endpoint Name="MyService" Protocol="http" Type="Input" Port="9025" />

However, this will:

<Endpoint Name="MyService" UriScheme="http" Port="9025" />

( The other attributes, I omitted, can still be added, but this would seem the minimum needed for Traefik to enumerate it as a viable backend)

A clear indication of wiring is indicated in the Traefik logs (this was previously absent)

Wiring frontend frontend-fabric:/MyApp/MyService to entryPoint http

AND, in the UI, for the backend, the server URI is displayed, again, this was not before.

Forgive me if this is documented somewhere, but I couldn't find anything OTHER than I did consider not seeing the server URI an issue based on a screenshot on the set up Website for Service Fabric and Traefik.

Another symptom is that the Backend, if not wired up correctly, will be displayed red, when correctly configured it will be green.

As I say, all probably very obvious but I lost many hours on this simple amendment I needed to make.



来源:https://stackoverflow.com/questions/52132155/which-matcher-should-i-use-for-a-service-hosted-on-localhost-port-for-a-local

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!