K8S插件 - 安装 Ingress

K8S插件 - 安装 Ingress

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

本文由 在码圈 创作,如果您觉得本文不错,请随意赞赏
采用 知识共享署名4.0 国际许可协议进行许可
您可以自由的转载和修改,但请务必注明文章来源并且不可用于商业目的。
本站部分内容收集于互联网,如果有侵权内容、不妥之处,请联系我们删除。敬请谅解!
原文链接:https://www.bedebug.com/archives/k8s-ingress-install
最后更新于:2022-04-19 18:26:33

请博主喝咖啡 ☕.