抛砖引玉(*-snippets块可以自定义header)
https://kubernetes.github.io/ingress-nginx/examples/customization/configuration-snippets/
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
set $auth "";
if ($request_method = OPTIONS) {
return 200;
}
if ($host ~* "(z.zzd.com)|(localhost)|(127.0.0.1)") {
set $auth "Bearer eyJrIjoiSU5JcGdFTlUxQ2RMVTU2STZ6YkFJZ0cyeEc2WGplYzciLCJuIjoiZGV2b3BzcGxhdGZvcm0iLCJpZCI6MX0=";
}
proxy_set_header Authorization "Bearer eyJrIjoiQmVxUTFnaVg1UDBKblpnZE02SnpWdmVoWWk2dHhKWlEiLCJuIjoiZGV2b3BzIiwiaWQiOjF9";
name: test-grafana
namespace: monitoring