k8s Service配置多个端口

Service

apiVersion: v1
kind: Service
metadata:
  name: xxx
  namespace: open
spec:
  type: NodePort
  ports:
  - name: tcp
    port: 8888
    targetPort: 8888
    nodePort: 8888
    protocol: TCP
  - name: http
    port: 8080
    targetPort: 8080
    nodePort: 8080
    protocol: TCP
  selector:
    name: xxx

Ingress

注意:只配置了tcp的端口

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: xxx-ingress
  namespace: open
spec:
  rules:
  - host: xxx.coding.net
    http:
      paths:
      - path: /
        backend:
          serviceName: xxx
          servicePort: 8888

你可能感兴趣的:(#,k8s)