方案一:Ingress配置
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/cors-allow-credentials: 'true'
nginx.ingress.kubernetes.io/cors-allow-headers: *
nginx.ingress.kubernetes.io/cors-allow-methods: GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD
nginx.ingress.kubernetes.io/cors-allow-origin: >-
https://uat.linux66.cn, https://dev-linux66.cn,
https://test-linux66.cn
nginx.ingress.kubernetes.io/enable-cors: 'true'
nginx.ingress.kubernetes.io/proxy-body-size: 100M
nginx.ingress.kubernetes.io/server-snippet: |
location = /ww_verify_hkF98S8SJDJQx.txt {
if ($host = "api.linux66.cn") {
return 200 "hkF98S8SJDJQx";
}
}
nginx.ingress.kubernetes.io/use-regex: 'true'
labels:
app.kubernetes.io/instance: dev-api-gateway
name: api-gateway
namespace: dev
spec:
ingressClassName: nginx
rules:
- host: api.linux66.cn
http:
paths:
- backend:
service:
name: api-internal-gateway
port:
number: 8080
path: /
pathType: ImplementationSpecific
tls:
- hosts:
- api.linux66.cn
secretName: linux66.cn
方案二:istio配置
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: api-gateway-virtualservice
namespace: istio-ingress
spec:
gateways:
- api-gateway
hosts:
- api.linux66.cn
http:
- directResponse:
body:
string: hkF98S8SJDJQx
status: 200
match:
- uri:
exact: /ww_verify_hkF98S8SJDJQx.txt
- match:
- uri:
prefix: /
route:
- destination:
host: api-internal-gateway.test.svc.cluster.local
port:
number: 8080
声明:
本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。