美文网首页初见
k8s nodePort类型的service,session保持

k8s nodePort类型的service,session保持

作者: PENG先森_晓宇 | 来源:发表于2020-05-26 17:09 被阅读0次
apiVersion: v1
kind: Service
metadata:
  name: helloworldsvc
  labels:
    weblogic-app: helloworld
spec:
  type: NodePort
  ports:
  - port: 7001
    protocol: TCP
    targetPort: 7001
    name: http
    nodePort: 30005
  selector:
    weblogic-app: helloworld
  sessionAffinity: ClientIP

最核心就是最后那句,会基于客户端访问服务的ip进行hash运算后把同一ip的请求路由到同一个pod.这样通过nodePort方式过来的请求就不会到处分发了

相关文章

网友评论

    本文标题:k8s nodePort类型的service,session保持

    本文链接:https://www.haomeiwen.com/subject/imyvahtx.html