KEMBAR78
Stateful set in kubernetes implementation & usecases | PPTX
StatefulSet
Krishna & Dhilip
Huawei India
February 25th 2017
Agenda
 Why StatefulSet
 Stateful application in the Cloud
 Stateful Vs Stateless
 Cloud Native/Micro Service
 Volumes in Statefulset
 Use Case
 Single Instance Stateful Application
 Multiple Instance Stateful Application
 Demo of Stateful Application Deployment
 Future Roadmap
 References
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.
Stateful vs. Stateless
Volumes in statefulset
Kubernetes to manage the stateless tiers of your ecosystem, you should
consider using the same infrastructure to manage your storage
applications.
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.
•emptyDir
•hostPath
•gcePersistentDisk
•awsElasticBlockStore
•Nfs
•Iscsi
•Flocker
•Glusterfs
•Rbd
•gitRepo
•Secret
•persistentVolumeClaim
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
patterns)
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 Single-Instance Stateful Application
Running a Multi-Instance Stateful Application
e.g:#1
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
features below.
e.g:#2
 DEMO – Redis Service in K8s (20 min.)
Current Status
 Was originally proposed as PetSet
 Became Statefulset from 1.5, you could migrate
Petset to statefulset now
 Re-written recently.
 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
 Initcontainers
 PodDisruptionBudget
 Interpod Anti-affinity / Anti-Affinity
 ConfigMaps
Future roadmap
 Support well defined upgrade
 Support arbitery field update
 Statefulset in federated clusters
 Statefulset compatible with shard based application /
legacy applications.
 A good Cleanup mechanism
 GC leftover PODs, leftover PVC and Services
References
•https://www.linkedin.com/pulse/strategies-running-stateful-applications-kubernetes-volumes-msv
•http://slides.com/wallnerryan/key-concepts-for-stateful-services-in-kubernetes#
•http://blog.kubernetes.io/2016/12/statefulset-run-scale-stateful-applications-in-kubernetes.html
•https://thenewstack.io/strategies-running-stateful-applications-kubernetes-pet-sets/
•https://clusterhq.com/2016/04/11/kubecon-microservices-kai/
Some contents in this presentation are taken from the references above. Thx to authors for the posting 
Thank You

Stateful set in kubernetes implementation & usecases

  • 1.
    StatefulSet Krishna & Dhilip HuaweiIndia February 25th 2017
  • 2.
    Agenda  Why StatefulSet Stateful application in the Cloud  Stateful Vs Stateless  Cloud Native/Micro Service  Volumes in Statefulset  Use Case  Single Instance Stateful Application  Multiple Instance Stateful Application  Demo of Stateful Application Deployment  Future Roadmap  References
  • 3.
    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.
  • 4.
  • 5.
    Volumes in statefulset Kubernetesto manage the stateless tiers of your ecosystem, you should consider using the same infrastructure to manage your storage applications. 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. •emptyDir •hostPath •gcePersistentDisk •awsElasticBlockStore •Nfs •Iscsi •Flocker •Glusterfs •Rbd •gitRepo •Secret •persistentVolumeClaim
  • 6.
    CloudNative / Microservices Cloudnative 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 patterns) 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 .
  • 7.
    Running a Single-InstanceStateful Application
  • 8.
    Running a Multi-InstanceStateful Application e.g:#1 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 features below. e.g:#2
  • 9.
     DEMO –Redis Service in K8s (20 min.)
  • 10.
    Current Status  Wasoriginally proposed as PetSet  Became Statefulset from 1.5, you could migrate Petset to statefulset now  Re-written recently.  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
  • 11.
    Statefulset and Friends Always needs additional Kubernetes entities to make it work very well  Service - Mandatory  Initcontainers  PodDisruptionBudget  Interpod Anti-affinity / Anti-Affinity  ConfigMaps
  • 12.
    Future roadmap  Supportwell defined upgrade  Support arbitery field update  Statefulset in federated clusters  Statefulset compatible with shard based application / legacy applications.  A good Cleanup mechanism  GC leftover PODs, leftover PVC and Services
  • 13.