简体   繁体   English

如何在 IPVS 模式下为 k8S 配置 Consul

[英]How can I configure Consul for k8S in IPVS mode

I'm use helm installed consul to k8s, but my server is having problems using it So.Please tell me how to solve it我正在使用 helm 安装 consul 到 k8s,但是我的服务器在使用它时遇到问题所以。请告诉我如何解决它

[root@master ~]# kubectl logs -n wrs pod/config-server-7b64695cc8-b8c4j -c consul-connect-inject-init
2022-06-15T14:12:18.679Z [INFO]  Registered service has been detected: service=config-server-service
2022-06-15T14:12:18.680Z [INFO]  Registered service has been detected: service=config-server-service-sidecar-proxy
2022-06-15T14:12:18.680Z [INFO]  Connect initialization completed
==> Error setting up traffic redirection rules: failed to run command: /sbin/iptables -t nat -N CONSUL_PROXY_INBOUND, err: exit status 3, output: modprobe: can't change directory to '/lib/modules': No such file or directory
iptables v1.8.7 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

environment:环境:

kubernetes v1.23.6 
proxy mode ipvs(not ip_tables)
helm 3.9.0
hashicorp/consul:1.12.0
hashicorp/consul-k8s-control-plane:0.44.0
CentOS Linux release 8.5.2111
Linux master 5.4.198-1.el8.elrepo.x86_64 #1 SMP Tue Jun 14 07:38:21 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux

I was able to get my service running but not working by executing the following command通过执行以下命令,我能够运行我的服务但无法正常工作

sudo modprobe ip_tables

Short term solution run modprobe iptables_nat in all worker nodes as root user which will load the module into kernel.短期解决方案以 root 用户身份在所有工作节点中运行 modprobe iptables_nat,这会将模块加载到 kernel。

Long term solution you need to use cni based solution and you can check https://www.nomadproject.io/docs/integrations/consul-connect您需要使用基于 cni 的解决方案的长期解决方案,您可以查看https://www.nomadproject.io/docs/integrations/consul-connect

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM