apiVersion: v1
kind: Service
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  type: NodePort
  ports:
    - name: http
      port: 80
      targetPort: 80
      protocol: TCP
      # 集群hosts文件中设置的 NODE_PORT_RANGE 作为 NodePort的可用范围
      # 从默认20000~40000之间选一个可用端口，让ingress-controller暴露给外部的访问
      nodePort: 23456
    - name: https
      port: 443
      targetPort: 443
      protocol: TCP
      # 集群hosts文件中设置的 NODE_PORT_RANGE 作为 NodePort的可用范围
      # 从默认20000~40000之间选一个可用端口，让ingress-controller暴露https
      nodePort: 23457
    - name: test-mysql
      port: 3306
      targetPort: 3306
      protocol: TCP
      nodePort: 23306
    - name: test-mysql-read
      port: 3307
      targetPort: 3307
      protocol: TCP
      nodePort: 23307
    - name: test-dns
      port: 53
      targetPort: 53
      protocol: UDP
      nodePort: 20053
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx

