HiveBrain v1.2.0
Get Started
← Back to all entries
patternkubernetesMinor

Kubernetes serve static content with ingress

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
ingresswithkubernetesservecontentstatic

Problem

I have a simple Django application and on a regular EC2 instance nginx is a reverse proxy serving static files and proxying requests to gunicorn/wsgi backend app.

Should I have a separate deployment and service for nginx which will be able to access static data on a volume to serve it as well as proxy requests to django pods or

Is it possible to configure ingress to serve static data without extra nginx deployment?

Solution

You can't configure your Ingress to serve static data (from your host files for example) alone because the Ingress resource is just a way to configure a way of understanding for Kubernetes on how to access a specific internal resource from outside the cluster.

An API object that manages external access to the services in a cluster, typically HTTP.
Ingress may provide load balancing, SSL termination and name-based virtual hosting.
-- Ingress | Kubernetes - https://kubernetes.io/docs/concepts/services-networking/ingress/

You must configure a web server (NGINX, Apache, etc.) with a mounted volume bound to your files. You'll also need a Service resource to publish the web server access internally. Then the Ingress resource will do the work.

Context

StackExchange DevOps Q#13936, answer score: 5

Revisions (0)

No revisions yet.