Description
Is there an existing issue for this?
- I have searched the existing issues
Enhancement description
In Kubernetes, livenessProbe and readinessProbes determine their result based on the HTTP.Status of 200. Thus, when using localstack, the endpoints /_localstack/health
and /_localstack/ready
will signal that the service is ready even when the startup scripts are still running.
To reproduce, add a lengthy /etc/localstack/init/ready.d/setup.sh
script (or a simple one with a sleep 60) to a k8s deployment of localstack. Deploy the localstack container into a cluster and watch the status report. It will be reported as running and ready as soon as the first readiness probe is executed. As mentioned, this is because the HTTP request returned a 200 (Ok) status. It does also return "completed": false,
as part of the body, but kubernetes is not able to parse that information.
A partial deployment is included below.
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: localstack
name: localstack
spec:
template:
metadata:
labels:
app: localstack
spec:
containers:
- name: localstack
image: localstack/localstack
ports:
- name: localstack
containerPort: 4566
protocol: TCP
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
httpGet:
path: /_localstack/health
port: localstack
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
httpGet:
path: /_localstack/init/ready
port: localstack
volumeMounts:
- mountPath: /etc/localstack/init/ready.d/01-setup.sh
name: localstack-ready-scripts
subPath: 01-setup.sh
🧑💻 Implementation
Please consider adding an additional ready query that returns 200 when the check on /_localstack/ready
would return "completed": true
. It should return a 200 when ready and 503 if the init scripts are still running.
Anything else?
No response