Question

How edit html pages for Ingress-nginx default backend on kubenetes

Posted February 11, 2021 1.2k views
NginxKubernetes

I have installed nginx-ingress via the 1-click process here on DO to my cluster. Everything is working flawlessly. In the helm chart values.yaml file there is an option to enable a default backend pod/image. This works as expected. What I can’t figure out is how to edit the html files inside the prebuilt image. For example 404.htm simply says “404 error” I know I can create my own custom backend image for this purpose but I am trying to stay with the helm chart resources as provided. Here are the references to what I am working from:

https://marketplace.digitalocean.com/apps/nginx-ingress-controller

This is the nginx docs I am following,

https://kubernetes.github.io/ingress-nginx/user-guide/custom-errors/

I have tried to exec into the pod but there seems to be no shell available for me to look around inside the image. I can’t find any git repo for the image so I don’t know what’s in side. The image spec'ed is k8s.gcr.io/defaultbackend-amd64

Any thoughts, or pointers to documentation on how to do this would be appreciated. I have posted this question on slack and at the git repo issues with no viable answers.

thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

What you could do is build your own image and change the www directory with your custom HTML error files.

You could take a look at this open-source example here:

https://github.com/kenmoini/custom-nginx-ingress-errors

Hope that this helps!
Regards,
Bobby