Skip to main content

Ingress and Ingress Controller

Last update:

Ingress is a Kubernetes object that defines rules for external traffic routing, load balancing, and SSL termination. Ingress Controller is a proxy server in a Managed Kubernetes cluster that routes traffic based on the rules defined in an Ingress.

In Managed Kubernetes, an Ingress Controller is not pre-installed in the cluster; you must install it yourself. The choice of controller depends on the requirements of the applications hosted in the Managed Kubernetes cluster. A list of possible controllers can be viewed in the Ingress Controllers section of the Kubernetes documentation. For example, you can install the Traefik Ingress Controller.

After installing the Ingress Controller, create an Ingress.

Install Traefik Ingress Controller

Along with the Ingress Controller, a load balancer will be automatically created with the following parameters:

  • IP address — public;
  • type — Basic with redundancy;
  • protocol — TCP.

You can select the load balancer type and configure other parameters for it — learn more about load balancer parameters in the Configure a load balancer instruction.

The load balancer will serve as the entry point for accessing applications in the cluster, so you do not need to create an internal load balancer additionally.

  1. Ensure that a quota for at least one public IP address is allocated in the project.

  2. Connect to the cluster.

  3. Install the Helm package manager.

  4. Add the traefik repository to Helm:

    helm repo add traefik https://traefik.github.io/charts
  5. Update the repository list:

    helm repo update
  6. Install the Ingress Controller:

    helm install traefik traefik/traefik
  7. Ensure the Ingress Controller is installed:

    kubectl get pods

    Information about the Ingress Controller will appear in the response. For example:

    NAME READY STATUS RESTARTS AGE
    traefik-78d5c6f95b-2xk9p 1/1 Running 0 51s

    A new load balancer will be created. It will appear in the Control Panel: in the top menu, click Products and select Cloud servers → section Load Balancers → tab Load Balancers.

Create an Ingress object

  1. Connect to the cluster.

  2. Create a yaml file with a manifest for the Ingress object.

    Example manifest:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
    name: example-ingress
    spec:
    ingressClassName: traefik
    rules:
    - http:
    paths:
    - path: /
    pathType: Prefix
    backend:
    service:
    name: hello-nginx
    port:
    number: 80
  3. Apply the manifest:

    kubectl apply -f <file_name>

    Specify <file_name> — the name of the yaml file with the manifest for creating the Ingress. For example, ingress.yaml.