pull/232/head
wangchuxiao 3 years ago
parent d71536ab86
commit aad4482a78

@ -27,12 +27,15 @@ spec:
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
name: msg-gateway-ingress
annotations: annotations:
kubernetes.io/ingress.class: "nginx" kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/proxy-http-version: "1.1" nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
# 使用重写后的路径进行路由
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: "/$1"
name: msg-gateway-ingress
spec: spec:
rules: rules:
- host: k8s.open-im-test.rentsoft.cn - host: k8s.open-im-test.rentsoft.cn
@ -41,9 +44,9 @@ spec:
- backend: - backend:
service: service:
name: msg-gateway name: msg-gateway
port: port:
number: 10001 number: 10001
path: / path: /msg-gateway/(.*)
pathType: Prefix pathType: Prefix
--- ---
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
@ -51,7 +54,7 @@ kind: Ingress
metadata: metadata:
annotations: annotations:
kubernetes.io/ingress.class: "nginx" kubernetes.io/ingress.class: "nginx"
# 使用重写后的路径进行路由 # 使用重写后的路径进行路由
nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: "/$1" nginx.ingress.kubernetes.io/rewrite-target: "/$1"
name: api-ingress name: api-ingress
@ -73,7 +76,7 @@ kind: Ingress
metadata: metadata:
annotations: annotations:
kubernetes.io/ingress.class: "nginx" kubernetes.io/ingress.class: "nginx"
# 使用重写后的路径进行路由 # 使用重写后的路径进行路由
nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: "/$1" nginx.ingress.kubernetes.io/rewrite-target: "/$1"
name: demo-ingress name: demo-ingress
@ -95,7 +98,7 @@ kind: Ingress
metadata: metadata:
annotations: annotations:
kubernetes.io/ingress.class: "nginx" kubernetes.io/ingress.class: "nginx"
# 使用重写后的路径进行路由 # 使用重写后的路径进行路由
nginx.ingress.kubernetes.io/use-regex: "true" nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: "/$1" nginx.ingress.kubernetes.io/rewrite-target: "/$1"
name: cms-api-ingress name: cms-api-ingress
@ -110,4 +113,4 @@ spec:
port: port:
number: 10006 number: 10006
path: /cms-api/(.*) path: /cms-api/(.*)
pathType: Prefix pathType: Prefix
Loading…
Cancel
Save