Skip to content

Commit b126a0e

Browse files
committed
Configure Liveness and Startup probes for kubernets
1 parent debc132 commit b126a0e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

kubernetes/main.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,15 @@ spec:
7373
volumeMounts:
7474
- name: certs-volume
7575
mountPath: /usr/src/app/certs
76+
livenessProbe:
77+
httpGet:
78+
port: 3000
79+
path: liveness
80+
periodSeconds: 3
81+
initialDelaySeconds: 5
82+
startupProbe:
83+
httpGet:
84+
port: 3000
85+
path: liveness
86+
periodSeconds: 3
87+
failureThreshold: 20

src/server/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ async def podname(request: web.Request):
99
return web.json_response({"podname": POD_NAME})
1010

1111

12+
async def liveness(_):
13+
return web.Response(status=200)
14+
15+
1216
async def start_site():
1317
app = web.Application()
1418
app.router.add_get("/podname", podname)
19+
app.router.add_get("/liveness", liveness)
1520

1621
runner = web.AppRunner(app)
1722
await runner.setup()

0 commit comments

Comments
 (0)