github.com/qsunny/k8s@v0.0.0-20220101153623-e6dca256d5bf/examples-master/cassandra/cassandra-statefulset.yaml (about)

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