当我将端口1234
和1235
添加到configMap时,我正试图弄清楚它是如何公开的。它可以工作,但我没有看到读取这些configMaps并公开服务的配置。
apiVersion: v1
kind: ConfigMap
metadata:
name: tcp-services
namespace: ingress-nginx
data:
1234: "test-web-dev/httpd:1234"
1235: "test-web-dev/tomcat7:1235"
---
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: ingress-nginx
labels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
spec:
externalTrafficPolicy: Local
type: LoadBalancer
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
- name: https
port: 443
protocol: TCP
targetPort: https
---
ConfigMap由Nginx Ingress消耗,如下所示:https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/
通常,您必须自己定义ConfigMap数据的使用方式,但Nginx Ingress的开发人员已经为您定义了,所以您只需要提供ConfigMap。