在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/網(wǎng)絡(luò)安全/ k8s 的 ingress,似乎沒法修改后端 url

k8s 的 ingress,似乎沒法修改后端 url

如果某的 service 提供的 api 是 /service/v1/module/method/resource
我想讓某個地址

https://service.xxx.com/module/method/resource 

直接指向到

/service/v1/module/method/resource, 

如何配置?

回答
編輯回答
帥到炸

App Root

Create an Ingress rule with a app-root annotation:

$ echo "
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/app-root: /app1
  name: approot
  namespace: default
spec:
  rules:
  - host: approot.bar.com
    http:
      paths:
      - backend:
          serviceName: http-svc
          servicePort: 80
        path: /
" | kubectl create -f -

Check the rewrite is working

$ curl -I -k http://approot.bar.com/
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.11.10
Date: Mon, 13 Mar 2017 14:57:15 GMT
Content-Type: text/html
Content-Length: 162
Location: http://stickyingress.example.com/app1
Connection: keep-alive
2017年5月11日 22:10