Reputation: 51
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 "
Upvotes: 4
Views: 2118
Reputation: 1653
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.
Upvotes: 4