在ningx-ingress中内置提供一些annotation 在不手动手动改ingress-controller的情况下可以提供一些方便的操作。

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: ""
nginx.ingress.kubernetes.io/proxy-body-size: 50m
nginx.ingress.kubernetes.io/service-weight: 'show-admin: 100
nginx.ingress.kubernetes.io/server-snippet: |
set sub_domain "";
if ( host ~* (.*)-admin.* ){
set sub_domain saas1;
}
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_input_headers "auth-com: saas$1";
generation: 4
name: test-ingress
namespace: default
spec:
rules:
- host: test.domain.com
http:
paths:
- backend:
serviceName: test-api
servicePort: 80
path: /
status:
loadBalancer: {}
  • more_set_headers 用于添加、修改、清除响应头
  • more_clear_headers 用于清除响应头
  • more_set_input_headers 用于添加、修改、清除请求头
  • more_clear_input_headers 用于清除请求头