k8s svc (clusterip)+ingress (负载均衡) 样本

 svc (clusterip):

---
kind: Service
apiVersion: v1
metadata:
  name: prod-svc-data-receiver
  namespace: jzyq
spec:
  clusterIP:  10.96.0.13
  ports:
  - name: data-receiver
    protocol: TCP
    port: 9870
    targetPort: 9870
  selector:
    phoenix/module: jzyq.Deployment.prod.data.receiver
  type: ClusterIP
  sessionAffinity: None

ingress(负载均衡):

---
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
  name: prod-access
  namespace: jzyq
spec:
  rules:
  - http:
      paths:
      - path: /rec
        backend:
          serviceName: prod-svc-rec-online
          servicePort: 9880
      - path: /upload
        backend:
          serviceName: prod-svc-data-receiver
          servicePort: 9870

# 创建之后需要添加负载均衡器lb1和lb2

你可能感兴趣的:(k8s svc (clusterip)+ingress (负载均衡) 样本)