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的负载均衡策略,比如随机。

查看

kubectl describe service demo-client --namespace=demo

你可能感兴趣的:(k8s的service负载均衡)