1. Ingress
配置文件准备
链接:https://pan.baidu.com/s/1IFCFkOe_qGkkmlnjfhUdHA
提取码:n7hv
2. 执行安装命令
kubectl create -f ingress-controller.yaml
kubectl create -f ingress-nginx-delpoy.yaml
3. 测试 Ingress
vi yapi-ingress.yaml
--------------------------------
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: yapi-ingress
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, OPTIONS"
nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization"
nginx.ingress.kubernetes.io/cors-allow-origin: "*"
spec:
rules:
- host: test.def
http:
paths:
- path: /
backend:
serviceName: yapi-app-service
servicePort: 3000
--------------------------------
kubectl create -f yapi-ingress.yaml