2
votes

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 "
1
They are tied by 'ingress class' concept. Each ingress controller is defined by its 'class', and each ingress rule may be marked with corresponding ingress.class annotation. Also you may set a default ingress class in you cluster, then ingress rules without class annotations will assume this default class.Olesya Bolobova
@OlesyaBolobova Could you please post these comments as an answer? This is correct answer to this question.Jakub

1 Answers

2
votes

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:

  • mandatory controller field which is a pointer to actual ingress controller binary,
  • optional 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.