You are browsing documentation for an outdated version. See the
latest documentation here.
Kubernetes Ingress Controller and Ingress Class
The Kubernetes Ingress Controller uses ingress classes to filter Kubernetes Ingress
objects and other resources before converting them into Kong configuration.
This allows it to coexist with other ingress controllers and/or other
deployments of the Kubernetes Ingress Controller in the same cluster: a
Kubernetes Ingress Controller will only process configuration marked for its use.
Configuring the controller ingress class
--ingress-class flag (or
CONTROLLER_INGRESS_CLASS environment variable)
specifies the ingress class expected by the Kubernetes Ingress Controller. By default,
it expects the
Loading resources by class
The Kubernetes Ingress Controller translates a variety of Kubernetes resources into
Kong configuration. Broadly speaking, we can separate these resources into two
- Resources that the controller translates directly into Kong configuration.
- Resources referenced by some other resource, where the other resource is
directly translated into Kong configuration.
For example, an Ingress is translated directly into a Kong route, and a
KongConsumer is translated directly into a
Kong consumer. A Secret containing
an authentication plugin credential is not translated directly: it is only
translated into Kong configuration if a KongConsumer resource references it.
Because they create Kong configuration independent of any other resources,
directly-translated resources require an ingress class, and their class must
match the class configured for the controller. Referenced resources do not
require a class, but must be referenced by a directly translated resource
that matches the controller.
Adding class information to resources
Most resources use a kubernetes.io/ingress-class annotation
to indicate their class. There are several exceptions:
When to use a custom class
Using the default
kong class is fine for simpler deployments, where only one
Kubernetes Ingress Controller instance is running in a cluster. Changing the class is
- You install multiple Kong environments in one Kubernetes cluster to handle
different types of ingress traffic, e.g. when using separate Kong instances
to handle traffic on internal and external load balancers, or deploying
different types of non-production environments in a single test cluster.
- You install multiple controller instances alongside a single Kong cluster to
separate configuration into different Kong workspaces (using the
--kong-workspace flag) or to restrict which Kubernetes namespaces any one
controller instance has access to.
Typical configurations will include a mix of resources that have class
information and resources that are referenced by them. For example, consider
the following configuration for authenticating a request, using a KongConsumer,
credential Secret, Ingress, and KongPlugin (a Service is implied, but not
- path: /vsemznakom
The KongConsumer and Ingress resources both have class annotations, as they are
resources that the controller uses as a basis for building Kong configuration.
The Secret and KongPlugin do not have class annotations, as they are
referenced by other resources that do.