skip to Main Content

I installed the ingress controller on my Kubernetes machine with helm, but somehow have no idea where the ingress controller puts the configuration file to be edited. We can find the helm file through helm list but what I mean is the code of the program itself.
I want to edit some algorithms from the ingress controller to do some projects.

Now I am using bitnami. I want to try to find the code for the algorithm. But still confused about what to do and what to use. do I have to use docker? Do I need to edit with any specific apps? I am confused about where is the Nginx ingress algorithm file source code.

2

Answers


  1. If you are using any open source ingress controller you might be able to get the code.

    For example :

    Nginx ingress controller : https://github.com/kubernetes/ingress-nginx

    Kong ingress controller : https://github.com/Kong/kubernetes-ingress-controller

    there could be chances pro or plus features won’t be there.

    Login or Signup to reply.
  2. There is a good guide how to build the NGINX Ingress Controller Image on the official NGINX website.
    Note: this project is different from the NGINX Ingress controller in kubernetes/ingress-nginx repo.

    So, change the ingress controller source code to tweak its algorithm and follow these steps:

    1. Before you can build the image, make sure that the following software is installed on your machine:
    • Docker v18.09+
    • GNU Make
    • git
    • OpenSSL, optionally, if you would like to generate a self-signed certificate and a key for the default server.
    1. Clone your Ingress Controller repo.

    2. Build the image using make tool like this:
      $ make debian-image PREFIX=myregistry.example.com/nginx-ingress TARGET=download
      Check the Makefile here.

    3. Push the image to your Docker registry like this:
      $ make push PREFIX=myregistry.example.com/nginx-ingress TAG=your-tag

    After that, create your own Helm chart for your custom Ingress Controller.

    Read this guide on how to create your first Helm Chart here. As a good production example you can take this NGINX Ingress Controller Helm Chart. You need to change the referenced image.
    Also, check this guide on how to install NGINX Ingress Controller using Helm.

    I hope this gives a good idea of how to build a custom Ingress Controller from the source code.

    EDIT:

    As for Load balancer algorithms, there are several built-in load balancer methods: least_conn, ip_hash, random, random two, random two least_conn.
    You can choose the load balancer method using annotation nginx.org/lb-method. See more info here.

    But if you still want to change the Load balancer algorithm, you will have to modify the source code and build a custom ingress controller or use some of the other existing ingress controllers.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search