...

/

Deploy the StatefulSet

Deploy the StatefulSet

Learn how to deploy the StatefulSet

We'll cover the following...

Now that we have a StorageClass and a headless Service, we can deploy the StatefulSet.

Example

The following YAML is from the sts.yml file and defines the StatefulSet.

Press + to interact
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: tkb-sts
spec:
replicas: 3
selector:
matchLabels:
app: web
serviceName: "dullahan"
template:
metadata:
labels:
app: web
spec:
terminationGracePeriodSeconds: 10
containers:
- name: ctr-web
image: nginx:latest
ports:
- containerPort: 80
name: web
volumeMounts:
- name: webroot
mountPath: /usr/share/nginx/html
volumeClaimTemplates:
- metadata:
name: webroot
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "flash"
resources:
requests:
storage: 10Gi

There’s a lot to take in, so let’s step through the important parts.

  • The ...

Access this course and 1400+ top-rated courses and projects.