Stateless confusing me a bit - need Help

Hello Community,

stateless applications are confusing me a bit. I thought stateless applications only provide static websites or simple sites without databases and PV.

After i read the kubernetes articel about the stateless App with frontendpods and 1 redis db pod for storing the guestbook entries([Example: Deploying PHP Guestbook application with Redis - Kubernetes], im pretty confused now. can someone explain me why there is a db in a stateless App, actualy every frontendpod have to get updated after a post ? for me, there is not a clear cut between stateless and stateful…

I would be glad about a link to this topic too :).

thank you so much. Jack

The front-end is stateless basically because it doesn’t store any kind of information needed. Any request can be routed to any front end and it will be handled correctly.

The state, though, is stored in redis. But the front-end itself is stateless.

Think, for example, if you are creating a storage system. You can’t avoid to have some kind of state, because you need to store the data, and you need to know which node has which data (or how it is replicated, etc ) to route a request accordingly.

The front-end were all process’s that are indistinguishable, you can even kill them and create them again that all will be fine. However, with the storage system you can’t do that so easily. The state is the difference :slight_smile:

Does this helps? Or makes it worse? :slight_smile:

Thanks you for your time mate.

If i understand you correctly the difference is where the state is safed? In statefull apps your pod have a state within and in stateless they can get attached to and external state/storeage. so the focus is on pods.

Yes. But be aware that if you need to attach a disk to each pod, it probably might be a stateful app.

However, if you read/write the state via the network (like with a database like MySQL, redis, etc.) you don’t have any state, just another component stores it. The other component (like the database, in this case) is stateful (and probably has storage attached).