O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a navegar o site, você aceita o uso de cookies. Leia nosso Contrato do Usuário e nossa Política de Privacidade.
O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a utilizar o site, você aceita o uso de cookies. Leia nossa Política de Privacidade e nosso Contrato do Usuário para obter mais detalhes.
Stateful set in kubernetes implementation & usecases
Krishna & Dhilip
February 25th 2017
Stateful application in the Cloud
Stateful Vs Stateless
Cloud Native/Micro Service
Volumes in Statefulset
Single Instance Stateful Application
Multiple Instance Stateful Application
Demo of Stateful Application Deployment
Why stateful set?
Deployments and ReplicaSets are a great way to run stateless replicas of an
application. Stateless containers like web servers - so-called “cattle” because they are
interchangeable, users are increasingly deploying stateful workloads with containers
to benefit from “build once, run anywhere”
These “pets” - so-called because each requires special handling - bring new
requirements including longer life cycle, configuration dependencies, stateful failover,
and performance sensitivity.
Pet Set sequences through the startup phase of each database replica (for example),
ensuring orderly master/slave configuration.
Pet Set also simplifies service discovery by leveraging ubiquitous DNS SRV records, a
well-recognized and long-understood mechanism.
1.3. Kubernetes support for stateful apps called pet set and 1.5 renamed it to stateful
set - Name change plus “at most one pod per index”, ordered deployment, ordered
termination, unique network names, and persistent stable storage.
Volumes in statefulset
Kubernetes to manage the stateless tiers of your ecosystem, you should
consider using the same infrastructure to manage your storage
Kubernetes doesn’t yet support isolation for network or storage I/O
across containers. Colocating your storage application with a noisy
neighbor can reduce the QPS that your application can handle.
CloudNative / Microservices
Cloud native not necessary 12 factor(Heroku way of doing)
Microservices is and architecture not necessarily cloud native
Workload could be data streaming instead of web.
Cloud Native is a set of patterns? (e.g: Cloud Foundry is one of the
OCI is for standards but CNCF is or projects, tools, APIs
Go is not necessary the language. Any language is OK. E.g:
Linkerd – is JVM
Cloudnative need not be containers only. Unikernals and functions
can be different.
Special purpose dev environment is serverless, it can be cloud
native or not.
Netflix OSS is JVM based
Running a Multi-Instance Stateful Application
Zookeeper is an interesting use case for StatefulSet for two reasons. First, it
demonstrates that StatefulSet can be used to run a distributed, strongly
consistent storage application on Kubernetes. Second, it's a prerequisite for
running workloads like Apache Hadoop and Apache Kakfa on Kubernetes.
An in-depth tutorial on deploying a ZooKeeper ensemble on Kubernetes is
available in the Kubernetes documentation, and we’ll outline a few of the key
Was originally proposed as PetSet
Became Statefulset from 1.5, you could migrate
Petset to statefulset now
Ordered/Sequenced Starting of PODs are going to
be relaxed. New Annotation
Debug Annotation will be removed.
More Focus on Stability
More charts are converted to Statefulset
Statefulset and Friends
Always needs additional Kubernetes entities to make
it work very well
Service - Mandatory
Interpod Anti-affinity / Anti-Affinity
Support well defined upgrade
Support arbitery field update
Statefulset in federated clusters
Statefulset compatible with shard based application /
A good Cleanup mechanism
GC leftover PODs, leftover PVC and Services
Some contents in this presentation are taken from the references above. Thx to authors for the posting