Workspace marked unhealthy while bootstrap entrypoint is still running #22059
Replies: 1 comment
-
|
I've hit this exact problem before. The workspace health check is kicking in before your bootstrap script finishes, so you need to tell Kubernetes to wait. Add an initialDelaySeconds to your bootstrap container's liveness/readiness probe that's longer than your bootstrap time. If you're not defining probes explicitly, the deployment is probably using defaults (like 0 initial delay), which is why it's marking unhealthy too early. Set something like initialDelaySeconds: 300 if your script can take up to 5 minutes. Also make sure the probes are pointing at something that won't exist until the Coder agent is actually running - maybe check /var/run/coder-agent.sock or whatever your agent exposes. That way the probe won't fire until the agent is ready, and the workspace won't flip unhealthy during bootstrap. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
In our Coder Terraform template, the kubernetes_deployment resource provisions two containers:
The bootstrap container uses a heredoc script as its entrypoint. This script is responsible for:
Problem
If the entrypoint script takes longer than expected to complete, the workspace is marked as unhealthy. Once the Coder agent starts inside the devcontainer, the workspace status eventually turns green.
This behavior causes temporary unhealthy states during normal startup when provisioning takes longer.
Question
Is there a recommended way to prevent the workspace from being marked unhealthy while the bootstrap entrypoint script is still running?
For example:
Adjusting health checks?
Delaying readiness checks?
Any guidance would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions