What the application must do differently.
WHAT TO EXPECT
Being stopped at any moment Running as several instances A filesystem that does not persist Configuration from the environment
WHAT THAT REQUIRES
No state held in memory between requests No reliance on local files Graceful shutdown Configuration externalised Logging to output
WHAT TO DO ABOUT SESSIONS
Store them externally, or make requests stateless.
WHAT TO DO ABOUT UPLOADS
Send them to object storage, not local disk.
WHAT TO DO ABOUT SCHEDULED WORK
Run it as a separate job, or ensure only one instance acts.
WHY
Several instances otherwise run the same task simultaneously.
WHAT TO IMPLEMENT FOR SHUTDOWN
Stop accepting work, finish what is in progress, then exit.
WHY
Otherwise every deployment drops requests.
WHAT TO MAKE FAST
Startup.
WHY
Slow startup makes scaling and deployment sluggish, and causes probe failures.
WHAT TO EXPOSE
Health endpoints.
WHAT TO AVOID
Writing to the image's filesystem Assuming a fixed hostname or address Depending on another service being available at startup
WHAT TO BUILD INSTEAD
Retries on connection.
WHAT TO TEST
Running two instances simultaneously.