简体   繁体   中英

What is the difference between NGINX Ingress Controller and Ingress with default backend as nginx service?

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: hello-kubernetes-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: hw1.your_domain
    http:
      paths:
      - backend:
          serviceName: hello-kubernetes-first
          servicePort: 80
  - host: hw2.your_domain
    http:
      paths:
      - backend:
          serviceName: hello-kubernetes-second
          servicePort: 80

vs

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress
spec:
  backend:
    serviceName: nginx-svc
    servicePort: 80

In the second yaml file nginx-svc points to a nginx controller which has the configMap that configures the routing of requests and other nginx related configuration.

The Ingress system is an abstraction over a simple HTTP fanout proxy, with routing on hostnames and URL prefixes. Nginx can be this kind of proxy, but it can also be an HTTP server. The first Ingres is a hostname-based fanout between two backend services. The second is a fallback route when no other rule matches, presumably aimed at an Nginx server that will send back some kind of simple HTTP page.

tl;dr Nginx can be both a proxy and a server. Ingress is proxy, nginx-svc is probably server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM