英文:
Which ingress documentation to follow? and how to apply nginx.conf?
问题
https://kubernetes.github.io/ingress-nginx/
or
https://docs.nginx.com/nginx-ingress-controller/
我可以直接使用已经工作的 nginx.conf 吗?可以为 nginx.conf 创建一个 configMap。如何将 configMap 应用于以下的 Ingress?
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
spec:
tls:
- hosts:
- "*.mydomin.com"
secretName: mydomain-ssl
rules:
- host: "*.mydomain.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: my-webapp
port:
number: 8080
英文:
https://kubernetes.github.io/ingress-nginx/
or
https://docs.nginx.com/nginx-ingress-controller/
Can I just use nginx.conf that is already working? A configMap can be created for the nginx.conf. How to apply the configMap to the following ingress?
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
spec:
tls:
- hosts:
- "*.mydomin.com"
secretName:mydomain-ssl
rules:
- host: "*.mydomain.com"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: my-webapp
port:
number: 8080
答案1
得分: 1
要使用 nginx.conf
创建一个配置映射,请参考这份官方的 Google 文档。
创建配置映射后,您可以使用 annotation “snippets”
将其应用到 Ingress 上,您可以在下面找到示例的 YAML,以获取更多信息,您可以查看这份 NGINX 文档。
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cafe-ingress-with-annotations
annotations:
nginx.org/proxy-connect-timeout: "30s"
nginx.org/proxy-read-timeout: "20s"
nginx.org/client-max-body-size: "4m"
nginx.org/server-snippets: |
location / {
return 302 /coffee;
}
spec:
英文:
To create a config map using the nginx.conf
refer to this official Google document.
After creating a config map you can use annotation “snippets”
to apply it to the ingress, you can find the sample yaml below and For more information you can follow this NGINX documentation.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cafe-ingress-with-annotations
annotations:
nginx.org/proxy-connect-timeout: "30s"
nginx.org/proxy-read-timeout: "20s"
nginx.org/client-max-body-size: "4m"
nginx.org/server-snippets: |
location / {
return 302 /coffee;
}
spec:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论