k8s.io/kubernetes@v1.29.3/test/e2e/testing-manifests/statefulset/cassandra/statefulset.yaml (about)

     1  apiVersion: apps/v1
     2  kind: StatefulSet
     3  metadata:
     4    name: cassandra
     5  spec:
     6    serviceName: cassandra
     7    replicas: 3
     8    selector:
     9      matchLabels:
    10        app: cassandra
    11    template:
    12      metadata:
    13        labels:
    14          app: cassandra
    15      spec:
    16        containers:
    17        - name: cassandra
    18          image: gcr.io/google-samples/cassandra:v13
    19          imagePullPolicy: Always
    20          ports:
    21          - containerPort: 7000
    22            name: intra-node
    23          - containerPort: 7001
    24            name: tls-intra-node
    25          - containerPort: 7199
    26            name: jmx
    27          - containerPort: 9042
    28            name: cql
    29          resources:
    30            requests:
    31             cpu: "300m"
    32             memory: 1Gi
    33          securityContext:
    34            capabilities:
    35              add:
    36                - IPC_LOCK
    37          lifecycle:
    38            preStop:
    39              exec:
    40                command:
    41                - /bin/sh
    42                - -c
    43                - nodetool drain
    44          env:
    45            - name: MAX_HEAP_SIZE
    46              value: 512M
    47            - name: HEAP_NEWSIZE
    48              value: 100M
    49            - name: POD_NAMESPACE
    50              valueFrom:
    51                fieldRef:
    52                  fieldPath: metadata.namespace
    53            - name: CASSANDRA_SEEDS
    54              value: "cassandra-0.cassandra.$(POD_NAMESPACE).svc.cluster.local"
    55            - name: CASSANDRA_CLUSTER_NAME
    56              value: "K8Demo"
    57            - name: CASSANDRA_DC
    58              value: "DC1-K8Demo"
    59            - name: CASSANDRA_RACK
    60              value: "Rack1-K8Demo"
    61            - name: POD_IP
    62              valueFrom:
    63                fieldRef:
    64                  fieldPath: status.podIP
    65          readinessProbe:
    66            exec:
    67              command:
    68              - /bin/bash
    69              - -c
    70              - /ready-probe.sh
    71            initialDelaySeconds: 15
    72            timeoutSeconds: 5
    73          # These volume mounts are persistent. They are like inline claims,
    74          # but not exactly because the names need to match exactly one of
    75          # the stateful pod volumes.
    76          volumeMounts:
    77          - name: cassandra-data
    78            mountPath: /cassandra_data
    79    # These are converted to volume claims by the controller
    80    # and mounted at the paths mentioned above.
    81    # do not use these in production until ssd GCEPersistentDisk or other ssd pd
    82    volumeClaimTemplates:
    83    - metadata:
    84        name: cassandra-data
    85      spec:
    86        accessModes: [ "ReadWriteOnce" ]
    87        resources:
    88          requests:
    89            storage: 1Gi
    90