可参看https://blog.csdn.net/weimeibuqieryu/article/details/140798925 搭建ingress
1.创建Ingress对象
ingress-ruoyi.yaml
其中host替换为你对应域名,需要解析域名到服务器, 同时为后端服务添加了二级域名解析 api.
访问http://xxx.xyz/就能访问前端, http://api.xxx.xyz/就能访问后端
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:name: multi-ingressnamespace: ruoyi
spec:ingressClassName: nginxrules:- host: xxx.xyzhttp:paths:- path: /pathType: Prefixbackend:service:name: nginx-serviceport:number: 80- host: api.xxx.xyzhttp:paths:- path: /pathType: Prefixbackend:service:name: ruoyi-serviceport:number: 8080
2.使用
kubectl apply -f ingress-ruoyi.yaml