安装后在裸机RPI群集上使用Metallb的LoadBalancer无法正常工作 [英] LoadBalancer using Metallb on bare metal RPI cluster not working after installation
问题描述
我正在摆弄使用Kubeadm
设置的RPI集群,并且希望使LoadBalancers能够在该集群上工作.
节点的IP是静态的,并且为主节点和工作节点的IP设置为192.168.1.100-192.168.1.103
的范围.
I'm fiddling around with my RPI cluster that I've setup using Kubeadm
and I want to make LoadBalancers able to work on the cluster.
The IPs for the nodes are static and set to the range of 192.168.1.100-192.168.1.103
for the master and worker nodes.
我已经使用官方网站文档安装了Metallb.
I've installed the Metallb using the offical site docs.
这是我的Metallb配置图:
This is my configmap for Metallb:
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
data:
config: |
address-pools:
- name: default
protocol: layer2
addresses:
- 192.168.2.240-192.168.2.250
据我了解,您应该为负载均衡器提供超出路由器DHCP范围的范围?但是,即使将地址范围更改为192.168.1.200-192.168.1.240
之类的内容,也不会改变我得到的结果.
From what I've understood you're supposed to give the loadbalancers a range outside of the DHCP range of the router? But even changing the addresses range to something like 192.168.1.200-192.168.1.240
doesn't change the results I'm getting.
我的路由器的DHCP设置.
The DHCP settings for my router.
K8s节点信息
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-master Ready master 5d15h v1.17.4 192.168.1.100 <none> Raspbian GNU/Linux 10 (buster) 4.19.97-v7l+ docker://19.3.8
k8s-worker-01 Ready worker 5d15h v1.17.4 192.168.1.101 <none> Raspbian GNU/Linux 10 (buster) 4.19.97-v7+ docker://19.3.8
k8s-worker-02 Ready worker 4d14h v1.17.4 192.168.1.102 <none> Raspbian GNU/Linux 10 (buster) 4.19.97-v7+ docker://19.3.8
k8s-worker-03 Ready worker 4d14h v1.17.4 192.168.1.103 <none> Raspbian GNU/Linux 10 (buster) 4.19.97-v7+ docker://19.3.8
然后我尝试设置一个小的nginx部署
Then I try to setup a small nginx deployment
kubectl run nginx --image=nginx
kubectl expose deploy nginx --port=80 --type=LoadBalancer
运行kubectl get svc
返回:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 5d15h
nginx LoadBalancer 10.96.53.50 <pending> 80:31253/TCP 4s
这就是我现在停留的地方.我似乎无法让LoadBalancer与此设置配合使用,而且我不确定自己出了什么问题.
This is where I'm stuck now. I don't seem to be able to get a LoadBalancer to work with this setup and I'm not really sure where I'm going wrong.
金属磅输出
NAME READY STATUS RESTARTS AGE
pod/controller-65895b47d4-q25b8 1/1 Running 0 68m
pod/speaker-bnkpq 1/1 Running 0 68m
pod/speaker-d56zg 1/1 Running 0 68m
pod/speaker-h9vpr 1/1 Running 0 68m
pod/speaker-qsl6f 1/1 Running 0 68m
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
daemonset.apps/speaker 4 4 4 4 4 beta.kubernetes.io/os=linux 68m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/controller 1/1 1 1 68m
NAME DESIRED CURRENT READY AGE
replicaset.apps/controller-65895b47d4 1 1 1 68m
推荐答案
除非启用了混杂模式,否则MetalLB layer2模式不会接收广播数据包.
MetalLB layer2 mode doesn't receive broadcast packets unless promiscuous mode is enabled.
尝试以下
sudo ifconfig wlan0 promisc
添加一个Crontab来运行每次启动,这样您就不会在重新启动时丢失此更改.
Add a Crontab to run each start up so you will not lose this change on restart.
1. sudo crontab -e
2. Add this line at the end of the file
@reboot sudo ifconfig wlan0 promisc
这篇关于安装后在裸机RPI群集上使用Metallb的LoadBalancer无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!