我应该使用哪个匹配器来服务,该服务应托管在本地Service Fabric群集的localhost {port}上 [英] Which matcher should I use for a service, hosted on localhost {port} for a local Service Fabric cluster

查看:102
本文介绍了我应该使用哪个匹配器来服务,该服务应托管在本地Service Fabric群集的localhost {port}上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Service Fabric和Traefik有疑问.

I have a question regarding Service Fabric and Traefik.

我已经成功地将Traefik应用程序部署到本地群集(实际上也部署在我自己的Azure Infra中).这是我试图将Traefik(RP)放在另一个应用程序中的服务(MyService)旁边.

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.

我可以看到Traefik仪表板,也可以看到一个后端(似乎表明它已成功为我的应用程序和服务成功调用了SF管理API).

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).

我还可以看到一个附带的前端,其中包含一些路由规则(匹配器).但是,对于我一生来说,我无法通过RP向我的服务提出简单的请求.

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.

我可以直接打我的服务. Service Fabric(SF)表示它也处于良好状态.

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

我的本​​地SF群集不受保护,因此可以通过设置.toml等简化操作.

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

我的服务也托管在localhost:9025上(端点在服务清单和端口设置(API中的Kestrel)中公开)相同.

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在端口5000上设置(而不是80,请参见下文).

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

要明确地进行简单的版本检查,我将使用 http://localhost:9025/myservice/myaction/v1/version

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

执行 http://localhost:5000/myservice/myaction/v1/version 可以让我得到404或503(取决于我对匹配器/修饰符的处理方式).

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

我也将Traefik端点也从端口80修改为5000,只是为了将其切换并避免任何端口冲突. (我现在没有IIS站点.)Netstat确认也没有使用其他端口.

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.

推荐答案

好, 因此,与Traefik有关的Service Manifest并没有错,而是Traefik无法理解的端点暴露在Manifest中.

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.

这行不通:

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

但是,这将:

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

(我遗漏的其他属性仍然可以添加,但这似乎是Traefik枚举它作为可行后端所需的最低要求)

( 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)

Traefik日志中(以前不存在)显示了明确的接线指示

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

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

并且,在UI中,对于后端,再次显示服务器URI,这不是以前的版本.

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

请原谅我,如果它记录在某处,但除了基于服务结构和Traefik的已设置网站上的屏幕截图,我没有考虑没有看到服务器URI之外,我找不到其他任何东西.

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.

这篇关于我应该使用哪个匹配器来服务,该服务应托管在本地Service Fabric群集的localhost {port}上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆