作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的 nginx 配置如下:
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 1g;
client_body_buffer_size 128k;
proxy_connect_timeout 120;
proxy_send_timeout 240;
proxy_read_timeout 240;
proxy_buffers 32 4k;
proxy_hide_header Strict-Transport-Security;
proxy_hide_header Content-Type;
add_header Content-Type application/json;
我想将我的 nginx 配置转换为 kubernetes ingress-nginx(入口资源)。有没有办法使用 kubernetes Ingress 资源来实现这个配置?阅读 ingress-nginx 文档我还没有找到如何将 proxy_pass 或多次重写映射到 Ingress 资源。我将不胜感激引用一些具有类似配置的详细文档或示例。
最佳答案
是的,可以按照说明使用代码段和自定义模板来做到这一点 here在 nginxinc 的 NGINX Ingress Controller 文档中。
通过 ConfigMap 使用片段的示例:
---
# Source: nginx-ingress/templates/controller-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
labels:
app.kubernetes.io/name: nginx-ingress
helm.sh/chart: nginx-ingress-0.3.4
app.kubernetes.io/managed-by: Tiller
app.kubernetes.io/instance: RELEASE-NAME
data:
server-snippets: |
location /helloworld {
proxy_redirect off;
proxy_http_version 1.1;
}
关于nginx - 如何将 Nginx 配置转换为 nginx-ingress?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54924405/
我是一名优秀的程序员,十分优秀!