liveBook · Manning

Stateless system

As explained in Road to Kubernetes

A stateless application is an application that does not retain client-specific state between requests or depend on persistent session state across restarts.

A stateless system does not retain client-specific state between requests or depend on persistent session state across restarts. Its environment can be recreated after the running machine or container is destroyed. section 5.1.4

Recreating a container environment

A Python or Node.js application remains stateless when its environment can be rebuilt from requirements.txt or package.json. By contrast, installing NGINX interactively inside an Ubuntu container does not persist after the container is removed with --rm. section 5.1.4 section 5.1.4

docker run --rm -it ubuntu /bin/bash
cat /etc/nginx/sites-available/default
nginx -v
exit

Use the commands to observe that an interactively modified container loses its NGINX installation when recreated. section 5.1.4

Deploy stateless applications by:

  • Rebuilding the application environment from its dependency files instead of modifying a running container manually. section 5.1.4
  • Using a Kubernetes Deployment for the running containers. section 8.5
  • Providing configuration through ConfigMaps and routing external traffic through a load-balancing Service. section 8.5

How Road to Kubernetes covers it

How deep it goes
Demonstrates environment recreation and temporary container changes, then applies the distinction to Kubernetes deployment configuration.
Examples
Uses Python and Node.js applications, dependency files, and an Ubuntu container with an interactively installed NGINX server.
What it assumes
Assumes basic applications and containers, while introducing why persistent data requires a separate stateful design.
What you can do after
Operate/configure stateless deployments with dependency files, Docker containers, ConfigMaps, Deployments, and load-balancing Services.
How it connects
Contrasts stateless applications with stateful applications and connects them to containers, virtual machines, and Kubernetes Deployments.

Also explained in

Compare how 14 books explain stateless system →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Road to Kubernetes. The section links point to the parts of the book it draws on.