apiVersion: apps/v1 kind: StatefulSet metadata: name: bot labels: app: bot spec: serviceName: "bot-headless" replicas: 2 selector: matchLabels: app: bot template: metadata: labels: app: bot spec: containers: - name: bot image: nekidev/payphone:latest env: - name: IS_DEBUG value: "false" - name: SHARD_ID valueFrom: fieldRef: fieldPath: metadata.labels['apps.kubernetes.io/pod-index'] - name: TOTAL_SHARDS value: "2" # Adjust this manually or with a ConfigMap resources: limits: cpu: "500m" memory: "512Mi" requests: cpu: "250m" memory: "256Mi" imagePullSecrets: - name: regcred volumeClaimTemplates: - metadata: name: bot-storage spec: accessModes: - ReadWriteOnce # Ensures only one node can mount the volume at a time resources: requests: storage: 1Gi # Defines the storage size --- apiVersion: v1 kind: Service metadata: name: bot-headless labels: app: bot spec: clusterIP: None selector: app: bot