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

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐