Let's go methodically over this example stateful set configuration file that declares a three-node Cassandra cluster.
Here is the basic metadata. Note the apiVersion string is apps/v1 (StatefulSet became generally available from Kubernetes 1.9):
apiVersion: "apps/v1" kind: StatefulSet metadata: name: cassandra
The stateful set spec defines the headless service name, how many pods there are in the stateful set, and the pod template (explained later). The replicas field specifies how many pods are in the stateful set:
spec: serviceName: cassandra replicas: 3 template: ...
The term replicas for the pods is an unfortunate choice because the pods are not replicas of each other. They share the same ...