Kubernetes 如何在路由器中为Istio入口网关配置传入端口
我尝试使用openshift路由配置istio入口。据我所知,请求路径如下:Kubernetes 如何在路由器中为Istio入口网关配置传入端口,kubernetes,routes,openshift,kubernetes-ingress,istio,Kubernetes,Routes,Openshift,Kubernetes Ingress,Istio,我尝试使用openshift路由配置istio入口。据我所知,请求路径如下: request -> route -> ingress service -> gateway -> virtual service -> app service -> app 因此,我应用以下配置: Route.yml: kind: Route ... spec: host: my-app.com to: kind: Service name
request -> route -> ingress service -> gateway -> virtual service -> app service -> app
因此,我应用以下配置:
Route.yml:
kind: Route
...
spec:
host: my-app.com
to:
kind: Service
name: ingress-service
weight: 100
port:
targetPort: http
...
ingress-service.yml:
kind: Service
metadata:
name: ingress-service
...
spec:
ports:
- name: status-port
protocol: TCP
port: 15020
targetPort: 15020
- name: http
protocol: TCP
port: 9080
targetPort: 9080
selector:
app: ingressgateway
istio: ingressgateway
type: ClusterIP
ingress-gateway.yml:
kind: Gateway
metadata:
name: ingress-gw
...
spec:
servers:
- hosts:
- my-app.com
port:
name: http
number: 9080
protocol: HTTP
selector:
istio: ingressgateway
ingress-virtual-service.yml
kind: VirtualService
...
spec:
hosts:
- my-app.com
gateways:
- ingress-gw
http:
- route:
- destination:
host: my-app
port: 9080
exportTo:
- .
我没有为入口通道吊舱在部署中设置端口9080。它是有效的。但前提是我向
我哪里出错了?如何使只能访问路径?外部端口的公开端口号取决于OpenShift上的路由器(HAProxy)pod侦听端口。如果您希望使用9080端口而不是80端口,则应更改路由器(HAProxy)pod上的端口。或者您可以处理LB上的端口号以使用其他端口号 访问流程如下所示
LB(80, 443)
-> Router pod(80, 443)
-> Ingress-Gateway pod
-Through Gateway and VirtualService -> Backend pod
外部端口的公开端口号取决于OpenShift上的路由器(HAProxy)pod侦听端口。如果您希望使用9080端口而不是80端口,则应更改路由器(HAProxy)pod上的端口。或者您可以处理LB上的端口号以使用其他端口号 访问流程如下所示
LB(80, 443)
-> Router pod(80, 443)
-> Ingress-Gateway pod
-Through Gateway and VirtualService -> Backend pod
这个配置是如何工作的?在入口服务中,我只暴露端口9080,为什么我可以访问端口80?在本例中,路由配置中的“targetPort”是什么意思?@pFlamy为什么您认为入口服务端口等于暴露端口?不允许外部请求直接访问服务网络。因此,服务端口仅在内部网络中可用,而不在外部网络中可用。所有外部请求都由入口控制器控制(在OpenShift的情况下,它是路由器pod(HAProxy))。使用“oc rsh-n openshift ingress cat haproxy.config”检查haproxy配置怎么样?它向您展示了如何将请求传输到后端播客。好的,我明白了。还有一个问题:kiali显示了一个警告,即部署没有指定服务中的所有端口。因此,如果我在入口部署中添加“containers.ports.containerPort”,警告将消失。但是为什么它不指定公开端口就可以工作?@pflamy-Hmm,你能通过新的票证在Kiali上分享你的问题的细节吗?Kiali上的交通路线现实和评估是不同的。这种配置是如何工作的?在入口服务中,我只暴露端口9080,为什么我可以访问端口80?在本例中,路由配置中的“targetPort”是什么意思?@pFlamy为什么您认为入口服务端口等于暴露端口?不允许外部请求直接访问服务网络。因此,服务端口仅在内部网络中可用,而不在外部网络中可用。所有外部请求都由入口控制器控制(在OpenShift的情况下,它是路由器pod(HAProxy))。使用“oc rsh-n openshift ingress cat haproxy.config”检查haproxy配置怎么样?它向您展示了如何将请求传输到后端播客。好的,我明白了。还有一个问题:kiali显示了一个警告,即部署没有指定服务中的所有端口。因此,如果我在入口部署中添加“containers.ports.containerPort”,警告将消失。但是为什么它不指定公开端口就可以工作?@pflamy-Hmm,你能通过新的票证在Kiali上分享你的问题的细节吗?Kiali上的交通路线现状和评价是不同的。