I'm currently trying to add health checks into my API through my helm chart. However, when I run this service under kubernetes it seems that my pod is ready but I have 0/1 Running and when I try to hit the URL for the service is not returning anything.
This is how my deployment looks:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "test.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "test.name" . }}
helm.sh/chart: {{ include "test.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "test.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "test.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
readinessProbe:
httpGet:
path: /health
port: 80001
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /health
port: 80001
initialDelaySeconds: 60
periodSeconds: 60
startupProbe:
httpGet:
path: /health
port: 80001
failureThreshold: 60
periodSeconds: 60
env:
{{- range .Values.variables }}
- name: {{ .name }}
value: {{ .value }}
{{- end }}
ports:
- name: http
containerPort: 80001
protocol: TCP
If I delete the health checks, I will have 1/1 Running. Does anyone knows if I have to add something else to the health checks?
CodePudding user response:
Your healthcheck specification looks syntactically fine. But your port number seems wrong: The maximum possible TCP port is 65535, you specify 80001. Probably a zero too many?
Verify which port your application is listening to in the container and use that port.
You can verify it by running the app as local docker container and call the health check with curl.