helm
helm copied to clipboard
How can I make sure my health checks work in kubernetes?
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: 8001
initialDelaySeconds: 60
periodSeconds: 60
livenessProbe:
httpGet:
path: /health
port: 8001
initialDelaySeconds: 60
periodSeconds: 60
startupProbe:
httpGet:
path: /health
port: 8001
failureThreshold: 60
periodSeconds: 60
env:
{{- range .Values.variables }}
- name: {{ .name }}
value: {{ .value }}
{{- end }}
ports:
- name: http
containerPort: 80001
protocol: TCP
If I deleted the health checks, I will have 1/1 Running. Does anyone knows if I have to add something else to the health checks?
Check the kubelet log for the node that the pod is on. That's where the health/readiness checks are logged.
@joejulian please create a issue in k8s project. Thanks very much.
I assume you meant to tag @hvaandres . 🙂
@joejulian & @yxxhero It seems that everything started to work now. I did an update on kubernetes and it seems that it fixed the issue. Also, the developers were able to find something wrong with the new end-points that they created for the application itself. So, I believe this now is working as expected