ingress实现的动静分离

  运维
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: https-test-com
  namespace: web
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: 10240m
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "300"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    nginx.ingress.kubernetes.io/configuration-snippet: |
      rewrite /h5/(.*)  /$1 break;
      rewrite /api/(.*)  /$1 break;
      rewrite /smspush/(.*)  /$1 break;
spec:
  tls:
  - hosts:
    - test.com
    secretName: tls-test-com
  rules:
  - host: test.com
    http:
      paths:
      - path: /
        backend:
          serviceName: my-portal
          servicePort: 80
      - path: /h5 
        backend:
          serviceName: my-h5
          servicePort: 80
      - path: /api 
        backend:
          serviceName: my-java
          servicePort: 7000
      - path: /smspush 
        backend:
          serviceName: my-python
          servicePort: 9202

LEAVE A COMMENT

Captcha Code