Skip to content

Commit b1219f6

Browse files
committed
feat: adding startup probes
1 parent f2dba5a commit b1219f6

File tree

4 files changed

+177
-3
lines changed

4 files changed

+177
-3
lines changed

charts/universal-chart/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ spec:
9999
containerPort: {{ .containerPort }}
100100
protocol: {{ .protocol | default "TCP" }}
101101
{{- end }}
102+
{{- with .Values.startupProbe }}
103+
startupProbe:
104+
{{- toYaml . | nindent 12 }}
105+
{{- end }}
102106
{{- with .Values.livenessProbe }}
103107
livenessProbe:
104108
{{- toYaml . | nindent 12 }}

charts/universal-chart/values.yaml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,42 @@ resources: {}
338338
# type: null
339339
# type: map
340340
# @schema
341-
# -- Configure a liveness probe, please
342-
# more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
341+
# -- Configure a startup probe to check if the application has started successfully.
342+
# The startup probe is used to give the application more time to start up before the
343+
# liveness probe takes over. This is especially useful for applications that take a
344+
# long time to initialize. Once the startup probe succeeds once, Kubernetes will
345+
# stop using it and switch to the liveness probe for ongoing health checks.
346+
# More information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
347+
# Example configuration:
348+
# startupProbe:
349+
# httpGet:
350+
# path: /diagnostics/health
351+
# port: http
352+
# periodSeconds: 5
353+
# failureThreshold: 60
354+
startupProbe:
355+
# httpGet:
356+
# path: /
357+
# port: http
358+
359+
# @schema
360+
# anyof:
361+
# type: null
362+
# type: map
363+
# @schema
364+
# -- Configure a liveness probe to detect hung or dead containers.
365+
# The liveness probe determines if a container is still running and healthy. If the
366+
# liveness probe fails, Kubernetes will restart the container. This is useful for
367+
# detecting situations where the application is running but unable to make progress
368+
# (e.g., deadlocked). The liveness probe runs throughout the container's lifetime.
369+
# More information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
370+
# Example configuration:
371+
# livenessProbe:
372+
# httpGet:
373+
# path: /internal/health
374+
# port: http
375+
# initialDelaySeconds: 30
376+
# periodSeconds: 10
343377
livenessProbe:
344378
# httpGet:
345379
# path: /
@@ -350,7 +384,22 @@ livenessProbe:
350384
# type: null
351385
# type: map
352386
# @schema
353-
# -- Configure a readiness probe, please
387+
# -- Configure a readiness probe to gate traffic until the application is ready to serve.
388+
# The readiness probe determines if a container is ready to accept traffic. If the
389+
# readiness probe fails, Kubernetes will remove the pod from service endpoints,
390+
# preventing traffic from being routed to it. Unlike the liveness probe, a failed
391+
# readiness probe does not restart the container - it simply stops sending traffic
392+
# to the pod until it becomes ready again. This is useful for applications that need
393+
# time to initialize or load data before they can handle requests.
394+
# More information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
395+
# Example configuration:
396+
# readinessProbe:
397+
# httpGet:
398+
# path: /internal/ready
399+
# port: http
400+
# initialDelaySeconds: 0
401+
# periodSeconds: 10
402+
# failureThreshold: 3
354403
readinessProbe:
355404
# httpGet:
356405
# path: /
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
# Source: universal-chart/templates/serviceaccount.yaml
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: universal-chart
7+
labels:
8+
helm.sh/chart: universal-chart-0.0.0-a.placeholder
9+
app.kubernetes.io/name: universal-chart
10+
app.kubernetes.io/instance: universal-chart
11+
app.kubernetes.io/managed-by: Helm
12+
automountServiceAccountToken: true
13+
---
14+
# Source: universal-chart/templates/service.yaml
15+
apiVersion: v1
16+
kind: Service
17+
metadata:
18+
name: universal-chart
19+
labels:
20+
helm.sh/chart: universal-chart-0.0.0-a.placeholder
21+
app.kubernetes.io/name: universal-chart
22+
app.kubernetes.io/instance: universal-chart
23+
app.kubernetes.io/managed-by: Helm
24+
spec:
25+
type: ClusterIP
26+
ports:
27+
- port: 3000
28+
targetPort: http
29+
protocol: TCP
30+
name: http
31+
selector:
32+
app.kubernetes.io/name: universal-chart
33+
app.kubernetes.io/instance: universal-chart
34+
---
35+
# Source: universal-chart/templates/deployment.yaml
36+
apiVersion: apps/v1
37+
kind: Deployment
38+
metadata:
39+
name: universal-chart
40+
labels:
41+
helm.sh/chart: universal-chart-0.0.0-a.placeholder
42+
app.kubernetes.io/name: universal-chart
43+
app.kubernetes.io/instance: universal-chart
44+
app.kubernetes.io/managed-by: Helm
45+
spec:
46+
replicas: 1
47+
revisionHistoryLimit: 3
48+
selector:
49+
matchLabels:
50+
app.kubernetes.io/name: universal-chart
51+
app.kubernetes.io/instance: universal-chart
52+
template:
53+
metadata:
54+
labels:
55+
helm.sh/chart: universal-chart-0.0.0-a.placeholder
56+
app.kubernetes.io/name: universal-chart
57+
app.kubernetes.io/instance: universal-chart
58+
app.kubernetes.io/managed-by: Helm
59+
spec:
60+
serviceAccountName: universal-chart
61+
containers:
62+
- name: universal-chart
63+
env: &containerenv
64+
# placeholder var so we can always make an env list
65+
- name: REDIS_ENABLED
66+
value: "false"
67+
image: "ghcr.io/example/app:1.2.3"
68+
imagePullPolicy: Always
69+
ports:
70+
- name: http
71+
containerPort: 3000
72+
protocol: TCP
73+
startupProbe:
74+
failureThreshold: 60
75+
httpGet:
76+
path: /diagnostics/health
77+
port: http
78+
periodSeconds: 5
79+
livenessProbe:
80+
httpGet:
81+
path: /internal/health
82+
port: http
83+
initialDelaySeconds: 30
84+
periodSeconds: 10
85+
readinessProbe:
86+
failureThreshold: 3
87+
httpGet:
88+
path: /internal/ready
89+
port: http
90+
initialDelaySeconds: 0
91+
periodSeconds: 10
92+
topologySpreadConstraints:
93+
- labelSelector:
94+
matchLabels:
95+
app.kubernetes.io/instance: universal-chart
96+
app.kubernetes.io/name: universal-chart
97+
maxSkew: 1
98+
topologyKey: topology.kubernetes.io/zone
99+
whenUnsatisfiable: ScheduleAnyway
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
image:
2+
repository: ghcr.io/example/app
3+
tag: "1.2.3"
4+
startupProbe:
5+
httpGet:
6+
path: /diagnostics/health
7+
port: http
8+
periodSeconds: 5
9+
failureThreshold: 60
10+
livenessProbe:
11+
httpGet:
12+
path: /internal/health
13+
port: http
14+
initialDelaySeconds: 30
15+
periodSeconds: 10
16+
readinessProbe:
17+
httpGet:
18+
path: /internal/ready
19+
port: http
20+
initialDelaySeconds: 0
21+
periodSeconds: 10
22+
failureThreshold: 3

0 commit comments

Comments
 (0)