[英]Kubernetes + Metallb: Nginx pod not receiving traffic with Local traffic Policy, Layer 2 mode
What happened: I changed my nginx service's externalTrafficPolicy to Local and now my nginx pod no longer receives traffic 发生了什么:我将Nginx服务的externalTrafficPolicy更改为Local,现在我的Nginx Pod不再接收流量
What you expected to happen: The nginx pod will continue to get traffic, but with the source ip intact. 您预期会发生的情况:Nginx Pod将继续获得流量,但源IP保持不变。 Using Layer 2 mode
使用第2层模式
Environment: 环境:
MetalLB version: 0.7.1 Kubernetes version: latest OS (eg from /etc/os-release): centos7 Kernel (eg uname -a): Linux K8SM1 3.10.0-862.3.2.el7.x86_64 #1 SMP Mon May 21 23:36:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux MetalLB版本:0.7.1 Kubernetes版本:最新操作系统(例如来自/ etc / os-release):centos7内核(例如uname -a):Linux K8SM1 3.10.0-862.3.2.el7.x86_64#1 SMP 5月21日23:36:36 UTC 2018 x86_64 x86_64 x86_64 GNU / Linux
I have an nginx pod that listens for UDP on port 80, and redirects the UDP packet to 192.168.122.206:8080 I have a simple udp server that listens on 192.168.122.206:8080. 我有一个Nginx Pod,它在端口80上侦听UDP,并将UDP数据包重定向到192.168.122.206:8080。我有一个简单的udp服务器,在192.168.122.206:8080上侦听。 This was working fine, but I needed to know the original source IP and port of the packet so I changed my service's traffic policy to local.
一切正常,但是我需要知道数据包的原始源IP和端口,因此我将服务的流量策略更改为本地。 Now, the pod doesn't seem to get traffic.
现在,广告连播似乎没有获得流量。 I am running a single node bare metal cluster.
我正在运行一个单节点裸机集群。 I have tried doing "kubectl logs pod-name" but nothing shows up, leading me to believe the pod isn't getting traffic at all.
我曾尝试做过“ kubectl日志pod-name”,但没有任何显示,这使我相信pod根本没有获得流量。 I am making sure that my UDP packet is being sent to the external ip of the nginx service and port 80.
我确保将我的UDP数据包发送到nginx服务和端口80的外部IP。
my nginx.conf from which I built the image: 我从中构建映像的nginx.conf:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
stream {
server {
listen 80 udp;
proxy_pass 192.168.122.206:8080;
}
}
My nginx deployment and service 我的Nginx部署和服务
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: asvilla/custom_nginx2:first
ports:
- name: http
containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
externalTrafficPolicy: Local
ports:
- name: http
port: 80
protocol: UDP
targetPort: 80
selector:
app: nginx
type: LoadBalance
I have set verbosity of my pods and containers logs to 9. They show nothing new when I send the packet. 我已将Pod和Container日志的详细级别设置为9。当我发送数据包时,它们没有任何新内容。 I also set verbosity to 9 for "kubectl describe service nginx" and that doesn't show anything new when I send the packet.
我还将“ kubectl describe service nginx”的详细程度设置为9,并且在发送数据包时未显示任何新内容。 My best guess here is that something is going wrong with kube-proxy?
我最大的猜测是kube-proxy出了什么问题? Also the fact that my master is my only node might be affecting something, although when I set it up I untainted it and allowed the scheduler to treat it as a worker node.
另外,我的主节点是我唯一的节点这一事实可能会影响某些方面,尽管在我设置它时我并未对其进行污染,并允许调度程序将其视为辅助节点。
Due to the fact that you have already pointed Service
to route the network traffic via UDP protocol, I guess this should also be allowed for Nginx Deployment
, adding protocol: UDP
parameter: 由于您已经将
Service
指向通过UDP协议路由网络流量的事实,我想Nginx Deployment
也应该允许这样做,添加protocol: UDP
参数:
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: asvilla/custom_nginx2:first
ports:
- name: http
containerPort: 80
protocol: UDP
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.