如果使用本地流量策略,Kubernetes负载均衡器将停止为流量提供服务 [英] Kubernetes loadbalancer stops serving traffic if using local traffic policy

查看:151
本文介绍了如果使用本地流量策略,Kubernetes负载均衡器将停止为流量提供服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我将某项服务设置为负载平衡器时遇到问题.我正在尝试像

Currently I am having an issue with one of my services set to be a load balancer. I am trying to get the source ip preservation like its stated in the docs. However when I set the externalTrafficPolicy to local I lose all traffic to the service. Is there something I'm missing that is causing this to fail like this?

负载均衡器服务:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: loadbalancer
    role: loadbalancer-service
  name: lb-test
  namespace: default
spec:
  clusterIP: 10.3.249.57
  externalTrafficPolicy: Local
  ports:
  - name: example service
    nodePort: 30581
    port: 8000
    protocol: TCP
    targetPort: 8000
  selector:
    app: loadbalancer-example
    role: example
  type: LoadBalancer
status:
  loadBalancer:
    ingress:
    - ip: *example.ip*

推荐答案

可能有几件事.一些建议:

Could be several things. A couple of suggestions:

  1. 您的服务正在获取外部IP,并且不知道如何基于Pod的本地IP地址进行回复.
    • 尝试在您的Pod上运行嗅探器,看看您是否正在从外部源获取数据包.
    • 尝试检查您的应用程序日志.
  1. Your service is getting an external IP and doesn't know how to reply back based on the local IP address of the pod.
    • Try running a sniffer on your pod see if you are getting packets from the external source.
    • Try checking at logs of your application.
  • 检查实例端口正在侦听. (如果您的健康检查失败,可能不会)

希望有帮助.

这篇关于如果使用本地流量策略,Kubernetes负载均衡器将停止为流量提供服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆