You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking to potentially switch to the FPM image. If I understood things correctly, using the fpm image, you would have a request/response flow like this:
nextcloud-fpm-alpine <-> nginx <-> ingress-nginx
To my understanding, this sort of defeats the purpose of using FastCGI to reduce latencies/bandwidth in the first place?
I think the major ingress controllers like ingress-gce, ingress-nginx, Traefik etc. support it, but I'm not sure if some special care needs to be taken w.r.t static content. Not really experienced in this. If I have time I'll have a look, currently using a home-rolled chart for Nextcloud and came here for inspiration, but I will share my findings if I come up with anything!
The user can set the image tag by image.tag or the tag will be determine by concatenate image.version and type.
At the ingress section, add a vendor key to specify ingress-nginx, traefik etc. Depending on this, the suitables annotations will be add to the ingress (if image.type is fpm, of course...)
The user can set the image tag by image.tag or the tag will be determine by concatenate image.version and type.
@tcoupin we currently have image.flavor which would be the same as image.type.
I experimented with this a little bit after #386 was merged, and I could set the nextcloud.containerPort to 9000, and didn't have much luck. I kept getting an error on nextcloud.dev.coolwebsitefordogs.com/index.php/login, but I forgot to take a screenshot. Will try to post my findings here. Currently testing on GKE and K3s with the ingress-nginx controller.
This results in Nextcloud coming up and initializing, and the ingress is up and healthy, however, when I try to go to nextcloud in the browser for cloud.example.com nextcloud throws a 404 for index.php in the pod logs and 404 for /login in the pod logs. The nextcloud app itself is healthy as it's created it's database and I'm able to use the occ command to download and install apps too, but the actual web interface is still not available and I'm not sure why 🤔
In the browser I see:
File not found.
In the nextcloud pod logs I see:
Initializing nextcloud 27.1.4.1...New nextcloud instance
Installing with PostgreSQL database
=>Searching for scripts (*.sh) to run, located in the folder:/docker-entrypoint-hooks.d/pre-installation
Starting nextcloud installation
Nextcloud was successfully installed
Setting trusted domains…
System config value trusted_domains =>1 set to string cloud.buildstars.online
=>Searching for scripts (*.sh) to run, located in the folder:/docker-entrypoint-hooks.d/post-installation
Initializing finished
=>Searching for scripts (*.sh) to run, located in the folder:/docker-entrypoint-hooks.d/before-starting
[01-Dec-202309:59:50] NOTICE: fpm is running, pid 1
[01-Dec-202309:59:50] NOTICE: ready to handle connections
10.42.0.7-01/Dec/2023:10:06:19+0000"GET /index.php"40410.42.0.7-01/Dec/2023:10:06:25+0000"GET /index.php"40410.42.0.7-01/Dec/2023:10:06:32+0000"GET /login"404
That's all the time I have for checking into this right now, but curious if anyone else makes it any further. good luck!
In addition to this, this block https://github.com/nextcloud/helm/blob/main/charts/nextcloud/templates/nginx-config.yaml#L118 and the fonts one below it a problematic. FPM is a php execution server and not a file server, much like it's pythonic "WSGI" server counterparts - they are not for serving static files like images or fonts. This is always handled by the web proxy, whether it's PHP in Apache, or FPM behind an HTTP proxy.
I've managed Kube a while but honestly have never looked into mounts being presented to an ingress controller for such a purpose - My search based on the ideas in this issue lead me to the official response, which is what I expected: nginx/kubernetes-ingress#323 (comment)
The Ingress Controller is not designed to serve static content. If you'd like to serve static content, consider having a separate Service for it.
the Ingress controller is not designed to serve static content. If you'd like to serve static content, consider having a separate Service for it
Honestly, this feels like the right response. Allowing an ingress controller to mount volumes would require it to have access to mount volume resources in all namespaces, versus today where it just has rights to mount TLS secrets and route to services in those namespaces.
This issue is a dead end in my eyes and that's a good thing. If you are interested in not having NGINX behind NGINX, you could look at alternative ingress controllers that are not built on webservers and are purely proxies - for example the haproxy ingress controller, or better yet - Cilium.
========
As an additional note, if Nextcloud (or any service you have in PHP-FPM) does not need to serve static files, then you can certainly just use ingress-nginx to proxy it.
If you are adamant about wanting to reduce service-specific web proxies for static files in your cluster, then going with a non-http ingress controller is a first step, then you can deploy your own proxy-pod and configure it to mount all required volumes containing static files and understand all services it needs to proxy. Effectively, build a proxy tier for all your applications that need static file serving and have any ingress for apps that have static files route to it instead of the application.
I feel like maybe that type of web proxy service may have a solution in K8S land that is not part of an Ingress service, but I'm not aware of one. I tend to prefer idempotent separation of concerns and would not want to have to roll proxies that front many services in order to mount another volume. You're also going to have to use a RWM volume type for that which presents other challenges.
@Routhinator thanks a lot for your insights! I agree with you, the ingress controller should not mount the volumes and have that level of acces. In my eyes we can close this issue then
Agree with @Routhinator and @provokateurin so closing this :) If someone has any further insights to provide, feel free to open a GitHub Discussion or continue commenting on this issue. If things change in the future with regards to the new gateway api or something, we can talk about reopening this.
Activity
provokateurin commentedon Mar 28, 2023
Sounds interesting! I think nobody thought about it. Would be interested to test this out if you make a PR.
provokateurin commentedon Mar 28, 2023
I guess this depends in the ingress you are using, but we should definitely have an option for enabling it.
JosefWN commentedon Mar 28, 2023
I think the major ingress controllers like
ingress-gce,ingress-nginx, Traefik etc. support it, but I'm not sure if some special care needs to be taken w.r.t static content. Not really experienced in this. If I have time I'll have a look, currently using a home-rolled chart for Nextcloud and came here for inspiration, but I will share my findings if I come up with anything!tcoupin commentedon Apr 21, 2023
I'm interresing into this enhancement.
What do you think about remove the nginx part and modify the
imagekey such as:The user can set the image tag by
image.tagor the tag will be determine by concatenateimage.versionandtype.At the ingress section, add a
vendorkey to specify ingress-nginx, traefik etc. Depending on this, the suitables annotations will be add to the ingress (ifimage.typeis fpm, of course...)tcoupin commentedon Apr 21, 2023
The probes parts must be updated too. When
image.typeis fpm, livenessprobe must executeocc statuscommand.Currently, the probes are disabled :
jessebot commentedon Apr 29, 2023
@tcoupin we currently have
image.flavorwhich would be the same asimage.type.I experimented with this a little bit after #386 was merged, and I could set the
nextcloud.containerPortto9000, and didn't have much luck. I kept getting an error on nextcloud.dev.coolwebsitefordogs.com/index.php/login, but I forgot to take a screenshot. Will try to post my findings here. Currently testing on GKE and K3s with the ingress-nginx controller.Here's the config map I used:
I can't figure out what parameters to pass into the ConfigMap to make this work 🤔
Here's my
imageandingressparts of my values.yaml:jessebot commentedon Nov 29, 2023
@JosefWN were you ever able to experiment with this?
Also open to anyone else in the community that may have had experience with this, as I'm unsure how to make this work.
jessebot commentedon Dec 1, 2023
I still haven't had success in making this work, but I got a lot further than last time. Here's where I got to the other day while testing this again:
I used the the branch in this PR to test everything, because I needed to be able to set securityContext without having an nginx container: #379
Here's my FastCGI configMap for the ingress-nginx object to use that I deployed to the nextcloud namespace on my cluster:
Image and ingress section of my values.yaml:
click me for the full
values.yamlThis results in Nextcloud coming up and initializing, and the ingress is up and healthy, however, when I try to go to nextcloud in the browser for cloud.example.com nextcloud throws a 404 for index.php in the pod logs and 404 for /login in the pod logs. The nextcloud app itself is healthy as it's created it's database and I'm able to use the occ command to download and install apps too, but the actual web interface is still not available and I'm not sure why 🤔
In the browser I see:
In the nextcloud pod logs I see:
That's all the time I have for checking into this right now, but curious if anyone else makes it any further. good luck!
Routhinator commentedon Jan 25, 2024
To make this work, you need to define all of the "location" elements from the nginx config provided by Nextcloud in the ingress definition https://github.com/nextcloud/helm/blob/main/charts/nextcloud/templates/nginx-config.yaml
In an ingress the equivalent for each of those statements is a path, and currently in this chart those are not overridable in a way that allows the addition of additonal paths: https://github.com/nextcloud/helm/blob/main/charts/nextcloud/templates/ingress.yaml
In addition to this, this block https://github.com/nextcloud/helm/blob/main/charts/nextcloud/templates/nginx-config.yaml#L118 and the fonts one below it a problematic. FPM is a php execution server and not a file server, much like it's pythonic "WSGI" server counterparts - they are not for serving static files like images or fonts. This is always handled by the web proxy, whether it's PHP in Apache, or FPM behind an HTTP proxy.
With the included nginx, the static files in the html directory are available to it because the volume mounts containing the static files are mounted in a location such that the path can be tried first by NGINX before forwarding the request to FPM
https://github.com/nextcloud/helm/blob/main/charts/nextcloud/templates/deployment.yaml#L202
I've managed Kube a while but honestly have never looked into mounts being presented to an ingress controller for such a purpose - My search based on the ideas in this issue lead me to the official response, which is what I expected: nginx/kubernetes-ingress#323 (comment)
And from the original comment in 2018:
Honestly, this feels like the right response. Allowing an ingress controller to mount volumes would require it to have access to mount volume resources in all namespaces, versus today where it just has rights to mount TLS secrets and route to services in those namespaces.
This issue is a dead end in my eyes and that's a good thing. If you are interested in not having NGINX behind NGINX, you could look at alternative ingress controllers that are not built on webservers and are purely proxies - for example the haproxy ingress controller, or better yet - Cilium.
========
As an additional note, if Nextcloud (or any service you have in PHP-FPM) does not need to serve static files, then you can certainly just use ingress-nginx to proxy it.
If you are adamant about wanting to reduce service-specific web proxies for static files in your cluster, then going with a non-http ingress controller is a first step, then you can deploy your own proxy-pod and configure it to mount all required volumes containing static files and understand all services it needs to proxy. Effectively, build a proxy tier for all your applications that need static file serving and have any ingress for apps that have static files route to it instead of the application.
I feel like maybe that type of web proxy service may have a solution in K8S land that is not part of an Ingress service, but I'm not aware of one. I tend to prefer idempotent separation of concerns and would not want to have to roll proxies that front many services in order to mount another volume. You're also going to have to use a RWM volume type for that which presents other challenges.
provokateurin commentedon Jan 25, 2024
@Routhinator thanks a lot for your insights! I agree with you, the ingress controller should not mount the volumes and have that level of acces. In my eyes we can close this issue then
jessebot commentedon May 1, 2024
Agree with @Routhinator and @provokateurin so closing this :) If someone has any further insights to provide, feel free to open a GitHub Discussion or continue commenting on this issue. If things change in the future with regards to the new gateway api or something, we can talk about reopening this.