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