Strategy for serving Django Admin static files in k8s environment

Been messing with this most of the day and have been stumped.

  • nginx-ingress isn’t designed to serve static files per this Github
    issue
    .
  • gunicorn isn’t either per documentatoin
  • WhiteNoise works locally with gunicorn, but doesn’t seem to like nginx-ingress and just returns a: Resource interpreted as Stylesheet but transferred with MIME type text/html

I’ve tried a few things, one of which:

  • Was FROM python:3.7-slim, copying the app over and then installing nginx into the image. Doesn’t seem like a good practice and couldn’t get it working.

The only other thing I can think of trying is a deployment and service just for the static files. However, not sure how to set that up, particularly the routing.

Any suggestions, or guidance, on how to serve static files (particularly Django Admin) in a k8s setup?

Source: StackOverflow