In kubernetes, if I have a ingress resource below, how does it know what type of Ingress Controller or which Ingress Controller (if I have multiple) to use?
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: test-ingress spec: rules:
- http: paths:
- path: /testpath backend: serviceName: test servicePort: 80 "
They are tied by ingress class concept.
Each ingress controller is defined by some IngressClass.
In a nutshell IngressClass is a simple wrapper object, which contains:
controller field which is a pointer to actual ingress controller binary,parameters field for additional configuration.Typically you would use predefined IngressClasses shipped with standard controllers, but nothing prevents you to define your own (though it's rarely needed in practice).
Each ingress rule may be marked with corresponding ingress.class annotation.
E. g. kubernetes.io/ingress.class: nginx
Also you may set a default ingress class in you cluster.
In this case ingress rules without class annotations will assume this default class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With