title: Flask: CSS and JS do not load in a kubernetes POD
body: <p>When I host a Flask application in Docker on my PC, the CSS and JS are read correctly from a template and HTML view formatted.
  When I host the same application in Kubernetes POD, it does not read CSS and JS.</p>
  
  <p>In a snapshot below you can see a result.
  <a href="https://i.stack.imgur.com/BTrwR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BTrwR.png" alt="example of CSS and JS not loading"></a>
  Below please find a file structure of the app.
  Views index.html and upload.html are extending public/templates/public_template.html which consists of imports of CSS and JS libraries.</p>
  
  <p>Could you please tell what could be the reason? Could the required file structure be different between kubectl and Docker?</p>
  
  <pre><code>C:.
  |   .gitignore
  |   Dockerfile
  |   upload_app-deploy.yaml
  |   run.py
  |
  \---app
      |   app.py
      |   requirements.txt
      |   __init__.py
      |
      +---static
      |   +---css
      |   |       bootstrap.min.css
      |   |       style.css
      |   |
      |   +---img
      |   |       flask.png
      |   |
      |   \---js
      |           app.js
      |           bootstrap.bundle.min.js
      |           jquery.slim.min.js
      |
      \---templates
          +---admin
          |   \---templates
          \---public
              |   index.html
              |   upload.html
              |
              \---templates
                      public_template.html 
  </code></pre>
  
  <p>Error in the browser:</p>
  
  <pre><code>Failed to load resource: the server responded with a status of 403 ()
  jquery.slim.min.js:1 Failed to load resource: the server responded with a status of 403 ()
  (index):1 Refused to apply style from 'https://ais-bt-services.asml.com/static/css/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
  app.js:1 Failed to load resource: the server responded with a status of 403 ()
  (index):1 Refused to apply style from 'https://ais-bt-services.asml.com/static/css/bootstrap.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/36fyM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/36fyM.png" alt="browser errors in kubernetes 1"></a>
  <a href="https://i.stack.imgur.com/Edh67.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Edh67.png" alt="browser errors in kubernetes 2"></a></p>
  
  <p>Dockerfile:</p>
  
  <pre><code># Python 3 running on Debian GNU/Linux 10 (buster)(ATM) (amd64)
  FROM XXX/docker/python:3
  
  # Fill directories
  COPY . /app
  
  # Switch default directory so f.e. you don't have to provide a full pwd of req.txt
  WORKDIR /app/app
  
  # Install python packages with fixed versions
  RUN pip install --force-reinstall -r requirements.txt
  
  # Execute an app: listener and handler
  CMD ["python", "/app/app/app.py"]
  </code></pre>
  
  <p>Below please find permissions to the catalogues, they seem OK to me, directories to 775 and files to 664 and the root user. Could it be that a user is different once running in Kubernetes? Or maybe any other ideas?
  <a href="https://i.stack.imgur.com/cxMl3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cxMl3.png" alt="PERMISSIONS"></a></p>