My simple Flask application runs perfectly in Docker container, but when I try to deploy it in Kubernetes using Helm, I keep encountering issues. The deployment shows READY 0/1 and AVAILABLE 0, indicating that no pods are running successfully.
My .yaml files:
Chart.yaml
apiVersion: v2
name: simpleflask
description: Helm chart for deploying a Flask application
version: 1.0.0
appVersion: "latest"
values.yaml
image:
repository: simpleflask
service:
port: 5000
hpa:
enabled: true
minReplicas: 1
maxReplicas: 5
metrics:
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: simpleflask-web
spec:
replicas: 1
selector:
matchLabels:
app: simpleflask
template:
metadata:
labels:
app: simpleflask
spec:
containers:
- name: simpleflask
image: simpleflask
port:
- containerPort: 5000
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
service.yaml
apiVersion: v1
kind: Service
metadata:
name: simpleflask-app
spec:
selector:
app: simpleflask
ports:
- protocol: TCP
port: 5000
targetPort: 5000
type: NodePort
Here’s my build and deployment process:
minikube start
eval $(minikube docker-env)
docker build -t simpleflask .
helm install simpleflask/ –generate-name
Output when i’m trying to deploy:
$ helm install simpleflask-chart/ --generate-name
W0510 07:57:58.783567 10112 warnings.go:70] unknown field "spec.template.spec.containers[0].port"
W0510 07:57:58.784104 10112 warnings.go:70] unknown field "spec.template.spec.resources"
NAME: simpleflask-chart-1715320678
LAST DEPLOYED: Fri May 10 07:57:58 2024
NAMESPACE: default
STATUS: deployed
REVISION: 1
$ kubectl get all
NAME READY STATUS RESTARTS AGE
pod/simpleflask-app-55c4c7864f-m2fpp 0/1 ImagePullBackOff 0 53s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 8m8s
service/simpleflask-app NodePort 10.111.83.200 <none> 5000:30996/TCP 53s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/simpleflask-app 0/1 1 0 53s
NAME DESIRED CURRENT READY AGE
replicaset.apps/simpleflask-app-55c4c7864f 1 1 0 53s
I’ve experimented with different Helm chart configurations, but I keep getting the same error (or a similar one). And also i was pulling image from Docker Hub. Could you help me identify the root cause of this issue?
I expect my app to be running and accessible on port 5000.
Shannon2 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.