英文:
Which ingress documentation to follow? and how to apply nginx.conf?
问题
你可以使用已经工作的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"
将其应用于入口,您可以在下面找到示例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:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论