##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

转载于:https://my.oschina.net/go4it/blog/778335

Logo

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

更多推荐