Skip to Main Content
The DevOps 2.4 Toolkit
book

The DevOps 2.4 Toolkit

by Viktor Farcic
November 2019
Intermediate to advanced content levelIntermediate to advanced
398 pages
9h 5m
English
Packt Publishing
Content preview from The DevOps 2.4 Toolkit

Using StatefulSets to run Stateful applications at scale

Let's see whether we can solve the problem with PersistentVolumes through a StatefulSet. As a reminder, our goal (for now) is for each instance of a MongoDB to get a separate volume.

The updated definition is in the sts/go-demo-3-sts.yml file.

 1  cat sts/go-demo-3-sts.yml

Most of the new definition is the same as the one we used before, so we'll comment only on the differences. The first in line is StatefulSet that replaces the db Deployment. It is as follows.

apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
  name: db
  namespace: go-demo-3
spec:
  serviceName: db
  replicas: 3
  selector:
    matchLabels:
      app: db
  template:
    metadata:
      labels:
        app: db
    spec:
 terminationGracePeriodSeconds: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The DevOps 2.2 Toolkit

The DevOps 2.2 Toolkit

Viktor Farcic

Publisher Resources

ISBN: 9781838643546Supplemental Content