我正在尝试使用ocelot网关访问我的kubernetes集群中的微服务“externalforum-api”。我跟踪了医生,但似乎不起作用。
有人能告诉我它有什么问题吗?
我希望将ocelot网关部署为clusterIP,并使用inside从集群外部访问它,但当试图从集群内的ocelot ->服务重新路由时,我将面临这个问题。
Ocelot.Responder.Middleware.ResponderMiddleware错误警告:
requestId: 0HMCO5SFMMOIQ:00000002,previousRequestId:无先前请求id,消息:错误代码: UnableToFindServiceDiscoveryProviderError消息:无法找到服务发现提供程序类型:在ResponderMiddleware中找到执行错误。设置请求路径的错误响应:/externalForumService,request方法: 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
发布于 2022-01-10 16:04:36
尝试将GlobalConfiguration部分中的"type : kube“更改为"type :GlobalConfiguration”。
发布于 2022-06-16 13:26:28
在我的情况下,错误是不同的,它不能映射适当的吊舱。所以你可以手动绘制地图
{
"Routes": [
{
"DownstreamPathTemplate": "/api/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "serviceName.Namespace.svc.cluster.local",
"Port": 80
}
],
"UpstreamPathTemplate": "/something/{everything}",
},....发布于 2022-05-13 17:16:47
在Ocelot 18 (Kubernetes 1.20)上,只需更新服务提供商类型,文档就过时了:
"GlobalConfiguration": {
"ServiceDiscoveryProvider": {
"Namespace": "propnull",
"Type": "KubernetesServiceDiscoveryProvider"
}
}https://stackoverflow.com/questions/69717277
复制相似问题