github链接 https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/exposing-tcp-udp-services.md
实践篇:
1、在ingress-controller的启动参数中添加以下内容:
--tcp-services-configmap=\$\(POD_NAMESPACE\)/tcp-services --udp-services-configmap=\$\(POD_NAMESPACE\)/udp-services
完整版的启动参数:
/nginx-ingress-controller --election-id=ingress-controller-leader --ingress-class=nginx --configmap=\$\(POD_NAMESPACE\)/ingress-nginx-controller --validating-webhook=:8443 --validating-webhook-certificate=/usr/local/certificates/cert --validating-webhook-key=/usr/local/certificates/key --tcp-services-configmap=\$\(POD_NAMESPACE\)/tcp-services --udp-services-configmap=\$\(POD_NAMESPACE\)/udp-services
2、部署tcp服务,这里不做详细说明,可以启动一个mysql;端口策略为:nodePort
image-20220323153215831.png
3、创建$(POD_NAMESPACE)/tcp-services 配置;我这边的ingress-controller 的命名空间为 ingress-nginx
image-20220323153458207.png4、网络防火墙开放30306端口
网友评论