如何通过Ingress访问MySQL或PostrgreSQL

Rancher Server 设置

  • Rancher 版本:2.7.5
  • RKE2 版本:1.26.7

问题描述:
​ Ingress 默认不支持 TCP 或 UDP,请问如何通过Ingress访问部署在Kubernetes的MySQL或PostrgreSQL?

这是我百度的,你可以试试:使用ingress代理mysql数据库_qq63076451a7368的技术博客_51CTO博客

链接中的第三步不适用RKE2,因为RKE2没有ingress-nginx-controller service。

[root@server-190 ~]# kubectl -n kube-system get svc
NAME                                      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                        AGE
pushprox-ingress-nginx-client             ClusterIP   10.43.198.58    <none>        10254/TCP                      5d7h
rancher-monitoring-coredns                ClusterIP   None            <none>        9153/TCP                       5d7h
rancher-monitoring-kubelet                ClusterIP   None            <none>        10250/TCP,10255/TCP,4194/TCP   5d7h
rke2-coredns-rke2-coredns                 ClusterIP   10.43.0.10      <none>        53/UDP,53/TCP                  7d18h
rke2-ingress-nginx-controller-admission   ClusterIP   10.43.177.201   <none>        443/TCP                        7d17h
rke2-metrics-server                       ClusterIP   10.43.27.48     <none>        443/TCP                        7d17h
rke2-snapshot-validation-webhook          ClusterIP   10.43.25.69     <none>        443/TCP                        7d17h