【发布时间】:2021-12-11 11:35:21
【问题描述】:
我正在尝试使用 ocelot 网关访问我的 kubernetes 集群内的微服务“externalforum-api-svc”。我已经关注了文档,但它似乎不起作用。
谁能告诉我它有什么问题?
我想将 ocelot api 网关部署为 clusterIP 并使用 Ingress 从集群外部访问它,但是在尝试从集群内的 ocelot -> 服务重新路由时遇到此问题。
## 错误警告:Ocelot.Responder.Middleware.ResponderMiddleware[0] requestId: 0HMCO5SFMMOIQ:00000002, previousRequestId: no previous 请求 ID,消息:错误代码: UnableToFindServiceDiscoveryProviderError 消息:无法找到 类型的服务发现提供程序:在中发现的 consul 错误 响应者中间件。为请求设置错误响应 路径:/externalForumService,请求方法:GET
{
"Routes": [
{
"UpstreamPathTemplate": "/externalForumService/GetAll",
"DownstreamPathTemplate": "/api/externalforum/v1/forum/GetAll",
"DownstreamScheme": "http",
"ServiceName": "externalforum-api-svc",
"UpstreamHttpMethod": [ "Get" ]
},
{
"UpstreamPathTemplate": "/externalForumService",
"DownstreamPathTemplate": "/api/externalforum/v1/forum",
"DownstreamScheme": "http",
"ServiceName": "externalforum-api-svc",
"UpstreamHttpMethod": [ "Get" ]
}
],
"GlobalConfiguration": {
"ServiceDiscoveryProvider": {
"Namespace": "propnull",
"Type": "kube"
}
}
}
地图服务
apiVersion: v1
kind: Service
metadata:
name: externalforum-api-svc
namespace: propnull
spec:
type: ClusterIP
selector:
app: externalforum-api
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
我已经跑过kubectl create clusterrolebinding permissive-binding --clusterrole=cluster-admin --user=admin --user=kubelet --group=system:serviceaccounts
规格
- 版本:17.0.0
- 平台:网核5.0
【问题讨论】:
标签: asp.net-core kubernetes microservices api-gateway ocelot