market-api in vitals-19fll97 warms its caches for 20 seconds after start and answers 503 until then. Its liveness probe does not wait:
sh
kubectl get pods -n vitals-19fll97
kubectl logs -l app=market-api -n vitals-19fll97
kubectl describe pod -l app=market-api -n vitals-19fll97Read the status code in the Unhealthy events. Then apply the Deployment with a startup probe in front of the liveness probe:
sh
kubectl apply -n vitals-19fll97 -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: market-api
spec:
replicas: 1
selector:
matchLabels:
app: market-api
template:
metadata:
labels:
app: market-api
spec:
containers:
- name: api
image: stackmonsters/monster-market-api
env:
- name: STARTUP_SECONDS
value: "20"
ports:
- containerPort: 8080
startupProbe:
httpGet:
path: /healthz
port: 8080
periodSeconds: 5
failureThreshold: 12
livenessProbe:
httpGet:
path: /healthz
port: 8080
periodSeconds: 2
EOFWait half a minute and check that RESTARTS stays at 0.