Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to load a custom module to an ingress-nginx deployment? #12765

Closed
varkey98 opened this issue Jan 29, 2025 · 11 comments
Closed

How to load a custom module to an ingress-nginx deployment? #12765

varkey98 opened this issue Jan 29, 2025 · 11 comments
Labels
needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@varkey98
Copy link

We have a custom module that we deploy to our nginx deployments? How can we load the same module to ingress-nginx deployments? We we using a custom lua plugin in place of it till now, but looks like that support got stopped and now we would like to load the ingress-nginx deployment with our custom nginx module

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 29, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority labels Jan 29, 2025
@varkey98
Copy link
Author

I tried using main-snippets directive in the config map, but did not work for me

@longwuyuan
Copy link
Contributor

We don't support loading custom modules because of difficulty in supporting and securing the controller with custom modules. You can look up older issues where others have tried and/or succeeded.

@Gacko
Copy link
Member

Gacko commented Jan 29, 2025

You can define an image which is being used as init container here:

https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml#L712

This image needs to contain the script described in the footer of the value. This script is then being executed on startup. You can also use distroless images, the binary executed changes to /init_module then.

https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/templates/_helpers.tpl#L247

@varkey98
Copy link
Author

@Gacko does this document(https://docs.nginx.com/nginx-ingress-controller/tutorials/nginx-dynamic-module/) not work anymore? I mounted my module to the pod and edited the config map, but still not seeing the module being there in the nginx.conf file

@longwuyuan
Copy link
Contributor

this is the K8S community controller project. That link is from the commercial product from NGINX INC

@varkey98
Copy link
Author

Ah sorry for being naive here. Thanks for all the help :)

@varkey98
Copy link
Author

I've been going though the helm charts, one thing I dont understand is how the nginx.conf gets modified with the new dynamic module's load_module directive when I specify an extraModule? Not very familiar with k8s or nginx, apologies if I missed something

@NgoHuy
Copy link

NgoHuy commented Feb 15, 2025

I've been going though the helm charts, one thing I dont understand is how the nginx.conf gets modified with the new dynamic module's load_module directive when I specify an extraModule? Not very familiar with k8s or nginx, apologies if I missed something

we may need to add this line to /etc/nginx/nginx.conf. Try if it works

@varkey98
Copy link
Author

I was able to update the nginx conf to load the new dynamic module using config map itself. This was the key to use:

| [main-snippet](#main-snippet) | string | "" | |

@NgoHuy
Copy link

NgoHuy commented Feb 16, 2025

oh greate, previous comment made me think it's impossibile, I use server-snippet to include new config and config map to load custom template, your comment is very helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
Development

No branches or pull requests

5 participants