Differences between revisions 2 and 3
Revision 2 as of 2021-10-25 04:13:43
Size: 1323
Editor: PieterSmit
Comment:
Revision 3 as of 2021-10-25 04:16:11
Size: 1488
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 39: Line 39:

   * or {{{
annotations:
  nginx.ingress.kubernetes.io/rewrite-target: /$2
...
spec:
  rules:
  - http:
     paths:
     - path: /something(/|$)(.*)
}}}

k8s/StudyNotes/k8s Ingress Service

  • Service [ clusterPort, nodePort]
    • Problem service nodePort > 30k, so need proxy server for port 80, 443 to this port.

  • On cloud set to LoadBalancer, still nodePort + talks to cloud paltform to configure the LB

    • e.g. svc1 p38080, svc2 p38282, need yet another load-balancer
  • Ingress - l7 loadbalancer config, path based.
    • Ingress controller Nginx, HAPROXY, traefik, GCE(Google), Istio
    • Ingress Resource

      apiVersion: networking.k8s.io/v1
      kind: Ingress
      spec: 
        rules:
        - host: wear.my-online-store.com 
          http:
            paths:
            - path: /wear
              pathType: Prefix
              backend:
                serviceName: wear-service
                servicePort: 80
            - path: /watch
              pathType: Prefix
              backend:
                serviceName: watch-service
                servicePort: 80
  • From 1.20,  kubectl create ingress <ingress-name> --rule="host.com/path*=wear-svc:80" 

  • Different ingress controllers can have annotations to set feature.
    • e.g. for nginx to strip /path/ when sending to backend service

        annotations:
          nginx.ingress.kubernetes.io/rewrite-target: /
    • or

      annotations:
        nginx.ingress.kubernetes.io/rewrite-target: /$2
      ...
      spec:
        rules:
        - http:
           paths:
           - path: /something(/|$)(.*)

k8s/StudyNotes/k8sIngressService (last edited 2021-10-25 04:16:11 by PieterSmit)