9. K8 StatefulSet

Stateful Apps

  • All DBs

  • Any App that stores data

  • Stateful apps are not perfect for containerized environments


StatefulSet

  • Maintains a sticky identity for each pod

  • created from same specification, but not interchangeable

  • persistent identifier across rescheduling

Scaling DB Apps

  • Each pod has separate job

  • They do not use same physical storage

  • Continuously synchronization of data must be done

    • master changes data

    • all workers sync with master

    • new pod clones data with previous pod

  • data will be lost when all pods die if persistent volume is not used

  • Remote storage should be used for rescheduling

  • Next pod is only created if previous is up and running

  • Deletion in reverse order, starting from last one

  • Each pod gets its own sticky identity i.e fixed predictable pod name and fixed individual dns name which means when pod restarts, ip address changes but name and endpoint stays same


Last updated