1. 官方文档
2. 编辑文件
root@docker01:/home# vim ingress-rule-2.yaml
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: ingress-limit-rate annotations: nginx.ingress.kubernetes.io/limit-rps: "1" spec: ingressClassName: nginx rules: - host: "haha.henggao.com" http: paths: - pathType: Exact path: "/" backend: service: name: nginx-demo port: number: 8000
3. 运行规则
root@docker01:/home# kubectl apply -f ingress-rule-2.yaml
4. 查看
root@docker01:/home# kubectl get ingress
5. 模拟域名访问
- 模拟域名,修改windows域名和端口映射
- 文件目录:
C:\Windows\System32\drivers\etc
的hosts文件
192.168.92.138 haha.henggao.com
6. 访问
刷新过快,会出现如下界面