Summary
I am trying to Deploy a Dockerized Streamlit Application to K8โs. I think I have everything working except for the Ingress.
I can port forward the pod and access the app, but when I go to the URL I get a blank screen and get these errors when I inspect:
I also see the following in the ingres-ngix pod logs:
Service โdev/contistreamlitapp-svcโ does not have any active Endpoint
Steps to reproduce
Where are my files
Code snippet:
deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: contistreamlitapp-dep
labels:
app: contistreamlitapp
namespace: {{ .Values.env }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: contistreamlitapp
template:
metadata:
labels:
app: contistreamlitapp
spec:
containers:
- name: contistreamlitapp
image: "{{ .Values.registry.server }}/{{ .Values.registry.image }}:{{ .Values.registry.tag }}"
imagePullPolicy: Always
ports:
- name: http
containerPort: 8501
protocol: TCP
readinessProbe:
httpGet:
path: /_stcore/health
port: 8501
initialDelaySeconds: 5
failureThreshold: 10
periodSeconds: 3
timeoutSeconds: 10
resources:
limits:
memory: 4Gi
cpu: 1
requests:
memory: 1Gi
cpu: 0
env:
- name: "SERVER_ENVIRONMENT"
value: dev
- name: "BASE_URL"
value: /contistreamlitapp/
nodeSelector:
"good-for-app": "true"
ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /contistreamlitapp/$2
nginx.ingress.kubernetes.io/proxy-connect-timeout: "7200"
nginx.ingress.kubernetes.io/proxy-read-timeout: "7200"
nginx.ingress.kubernetes.io/proxy-send-timeout: "7200"
name: contistreamlitapp-ingress
namespace: dev
spec:
tls:
- hosts:
- {{ .Values.ingress.host }}
secretName: aks-ingress-tls
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /contistreamlitapp(/|$)(.*)
pathType: Prefix
backend:
service:
name: contistreamlitapp-svc
port:
number: 8501
service.yaml
apiVersion: v1
kind: Service
metadata:
name: contistreamlitapp-svc
namespace: dev
spec:
type: ClusterIP
ports:
- port: 8501
selector:
app: contistreamapp
Dockerfile
FROM python-base:latest AS contistreamlitapp
COPY . /app/
WORKDIR /app
RUN pip install -r requirements.txt
ENV PYTHONPATH /app
EXPOSE 8501
ENTRYPOINT ["streamlit", "run", "contistreamlitapp/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
Can Anyone see what I might be wrong