ingress-nginx的各種nginx規則定義

官方文檔:https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md

工作中遇到的實際問題總結:

1.nginx的路徑和後端的路徑不同;
例:訪問xxx.xxx/apppy/api/test/pic的時候跳轉到後端 xxx:xxx:8080/api/test/pic

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
  name: gos-api
  namespace: gos
spec:
  rules:
    - host: api.baidu.com
      http:
        paths:
          - backend:
              serviceName: gos-api
              servicePort: 80
            path: /apppy(/|$)(.*)




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章