<p>I have a small application built in Django. it serves as a frontend and it's being installed in one of out K8S clusters.</p>

<p>I'm using helm to deploy the charts and I fail to serve the static files of Django correctly.</p>

<p>Iv'e searched in multiple locations, but I ended up with inability to find one that will fix my problem.</p>

<h2>That's my ingress file:</h2>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: orion-toolbelt
  namespace: {{ .Values.global.namespace }}
  annotations:
    #    ingress.kubernetes.io/secure-backends: "false"
    #    nginx.ingress.kubernetes.io/secure-backends: "false"
    ingress.kubernetes.io/rewrite-target: /
    nginx.ingress.kubernetes.io/rewrite-target: /
    ingress.kubernetes.io/force-ssl-redirect: "false"
    nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
    ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    ingress.kubernetes.io/ingress.allow-http: "true"
    nginx.ingress.kubernetes.io/ingress.allow-http: "true"
    nginx.ingress.kubernetes.io/proxy-body-size: 500m
spec:
  rules:
    - http:
        paths:
          - path: /orion-toolbelt
            backend:
              serviceName: orion-toolbelt
              servicePort: {{ .Values.service.port }}

</code></pre>

<hr>

<p>the static file location in django is kept default e.g.</p>

<pre><code>STATIC_URL = "/static"
</code></pre>

<p>the user ended up with inability to access the static files that way..</p>

<p>what should I do next?</p>

<p>attached is the error: 
<a href="https://i.stack.imgur.com/u1Zsl.png" rel="nofollow noreferrer">HTML-static_files-error</a>
-- EDIT: 5/8/19 --
The pod's deployment.yaml looks like the following:</p>

<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  namespace: {{ .Values.global.namespace }}
  name: orion-toolbelt
  labels:
    app: orion-toolbelt
spec:
  replicas: 1
  selector:
    matchLabels:
      app: orion-toolbelt
  template:
    metadata:
      labels:
        app: orion-toolbelt
    spec:
      containers:
        - name: orion-toolbelt
          image: {{ .Values.global.repository.imagerepo }}/orion-toolbelt:10.4-SNAPSHOT-15
          ports:
            - containerPort: {{ .Values.service.port }}
          env:
            - name: "USERNAME"
              valueFrom:
                secretKeyRef:
                  key:  username
                  name: {{ .Values.global.secretname }}
            - name: "PASSWORD"
              valueFrom:
                secretKeyRef:
                  key:  password
                  name: {{ .Values.global.secretname }}
            - name: "MASTER_IP"
              valueFrom:
                secretKeyRef:
                  key:  master_ip
                  name: {{ .Values.global.secretname }}
          imagePullPolicy: {{ .Values.global.pullPolicy }}
      imagePullSecrets:
        - name: {{ .Values.global.secretname }}
</code></pre>

<p>EDIT2: 20/8/19 - adding service.yam</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  namespace: {{ .Values.global.namespace }}
  name: orion-toolbelt
spec:
  selector:
    app: orion-toolbelt
  ports:
    - protocol: TCP
      port: {{ .Values.service.port }}
      targetPort: {{ .Values.service.port }}
</code></pre>

ForMartha
<p>You should simply contain the /static directory within the container, and adjust the path to it in the application. 
Otherwise, if it must be /static, or you don't want to contain the static files in the container, or you want other containers to access the volume, you should think about mounting a Kubernetes volume to your Deployment/ Statefulset.</p>

<p>@Edit</p>

<p>You can test, whether this path exists in your kubernetes pod this way: </p>

<p><code>kubectl get po</code> &lt;- this command will give you the name of your pod</p>

<p><code>kubectl exec -it &lt;name of pod&gt; sh</code> &lt;-this command will let you execute commands in the container shell. </p>

<p>There you can test, if your path exists. If it does, it is fault of your application, if it does not, you added it wrong in the Docker.</p>

<p>You can also add path to your Kubernetes pod, without specifying it in the 
Docker container. <a href="https://kubernetes.io/docs/concepts/storage/volumes/" rel="nofollow noreferrer">Check this link for details</a></p>
