k8s的service負載均衡

service

apiVersion: v1
kind: Service
metadata:
  name: demo-client
  namespace: demo
  labels:
    service: demo-client
spec:
  selector:
    app: demo-client
  ports:
    - name: http
      port: 3000
      targetPort: 3000
      protocol: TCP
  clusterIP:  11.0.0.98
  sessionAffinity: ClientIP

其中sessionAffinity能夠指定爲ClientIP或者None
默認是根據kube-proxy的負載均衡策略,好比隨機。api

查看

kubectl describe service demo-client --namespace=demo
相關文章
相關標籤/搜索