Hi folks,
I have an application with following three different docker containers:-
Frontend(react)
Back-end(django)
Nginx for serving static files from frontend,
I am trying to access nginx website in Kubernetes (minikube).from
minikube service my-service
all other data is being served from backend container but only image is not being sent
Can someone please help.
debug is true and
MEDIA_URL = ‘/media/’
MEDIA_ROOT = os.path.join(BASE_DIR ,“/app/media”)
I have kept the name of django app as django-service,
should I change the following lines in setttings.py file to django-service as well ?
ROOT_URLCONF = 'backend.urls'
WSGI_APPLICATION = 'backend.wsgi.application'
here is entrypoint.sh file with same name
#!/bin/sh
gunicorn backend.wsgi:application --bind 0.0.0.0:8000
and following is deploment resources
# Django Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: django-app
spec:
replicas: 1
selector:
matchLabels:
app: django-app
template:
metadata:
labels:
app: django-app
spec:
containers:
- name: django-container
image: ash414/e-cart-backend:v1.0
ports:
- containerPort: 8000
# Django Service
apiVersion: v1
kind: Service
metadata:
name: django-service
labels:
app: django-app
spec:
selector:
app: django-app
ports:
- protocol: TCP
port: 8000
targetPort: 8000
# Nginx Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-app
labels:
app: nginx-app
spec:
replicas: 1
selector:
matchLabels:
app: nginx-app
template:
metadata:
labels:
app: nginx-app
spec:
containers:
- name: nginx-container
# Not working images
# image: e-cart-nginx:latest
# image: ash414/e-cart-nginx:v1.0v
# image: ash414/e-cart-nginx-dj4:v1.0
image: ash414/nginx-app4:v1.0
ports:
- containerPort: 80
# Nginx Service
apiVersion: v1
kind: Service
metadata:
name: nginx-service
labels:
app: nginx-app
spec:
selector:
app: nginx-app
ports:
- protocol: TCP
port: 80
targetPort: 80
# NodePort Service
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
selector:
app: nginx-app
ports:
- port: 80
targetPort: 80
nodePort: 30007