github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/cloud/kubernetes/performance/cockroachdb-daemonset-insecure.yaml (about)

     1  # This configuration file sets up a DaemonSet running CockroachDB in insecure
     2  # mode. For more information on why you might want to use a DaemonSet instead
     3  # of a StatefulSet, see our docs:
     4  # https://www.cockroachlabs.com/docs/stable/kubernetes-performance.html#running-in-a-daemonset
     5  #
     6  # To use this file, customize the parts labeled "TODO" before running:
     7  #   kubectl create -f cockroachdb-daemonset-insecure.yaml
     8  #
     9  # Initialize the cluster by picking one of the CockroachDB pod names from
    10  # the output of `kubectl get pods`, then run:
    11  #   kubectl exec -it <pod-name> -- ./cockroach init --insecure
    12  #
    13  # If you're interested in using a DaemonSet in secure mode instead, please see
    14  # cockroachdb-daemonset-secure.yaml.
    15  apiVersion: v1
    16  kind: Service
    17  metadata:
    18    # This service is meant to be used by clients of the database. It exposes a ClusterIP that will
    19    # automatically load balance connections to the different database pods.
    20    name: cockroachdb-public
    21    labels:
    22      app: cockroachdb
    23  spec:
    24    ports:
    25    # The main port, served by gRPC, serves Postgres-flavor SQL, internode
    26    # traffic and the cli.
    27    - port: 26257
    28      targetPort: 26257
    29      name: grpc
    30    # The secondary port serves the UI as well as health and debug endpoints.
    31    - port: 8080
    32      targetPort: 8080
    33      name: http
    34    selector:
    35      app: cockroachdb
    36  ---
    37  apiVersion: policy/v1beta1
    38  kind: PodDisruptionBudget
    39  metadata:
    40    name: cockroachdb-budget
    41    labels:
    42      app: cockroachdb
    43  spec:
    44    selector:
    45      matchLabels:
    46        app: cockroachdb
    47    maxUnavailable: 1
    48  ---
    49  apiVersion: apps/v1
    50  kind: DaemonSet
    51  metadata:
    52    name: cockroachdb
    53    labels:
    54      app: cockroachdb
    55  spec:
    56    selector:
    57      matchLabels:
    58        app: cockroachdb
    59    template:
    60      metadata:
    61        labels:
    62          app: cockroachdb
    63      spec:
    64        # TODO: Remove the nodeSelector section if you want CockroachDB to run on all nodes in your cluster.
    65        # To give nodes this label, run:
    66        #   kubectl label node <node-name> app=cockroachdb
    67        nodeSelector:
    68          app: cockroachdb
    69        # Tolerations allow CockroachDB to run on Kubernetes nodes that other pods won't be allowed on.
    70        # To set up nodes to be dedicated to CockroachDB, you must "taint" them by running:
    71        #   kubectl taint node <node-name> app=cockroachdb:NoSchedule
    72        # If you don't set up any such taints, these tolerations will have no effect.
    73        tolerations:
    74        - key: "app"
    75          operator: "Equal"
    76          value: "cockroachdb"
    77          effect: "NoSchedule"
    78        # NOTE: Running with `hostNetwork: true` means that CockroachDB will use
    79        # the host machines' IP address and hostname, and that nothing else on
    80        # the machines will be able to use the same ports.
    81        hostNetwork: true
    82        containers:
    83        - name: cockroachdb
    84          image: cockroachdb/cockroach:v20.1.1
    85          imagePullPolicy: IfNotPresent
    86          # TODO: If you configured taints to give CockroachDB exclusive access to nodes, feel free
    87          # to remove the requests and limits sections. If you didn't, you'll need to change these to
    88          # appropriate values for the hardware that you're running. You can see the amount of
    89          # allocatable resources on each of your Kubernetes nodes by running:
    90          #   kubectl describe nodes
    91          resources:
    92            requests:
    93              cpu: "16"
    94              memory: "8Gi"
    95            limits:
    96              # NOTE: Unless you have enabled the non-default Static CPU Management Policy
    97              # and are using an integer number of CPUs, we don't recommend setting a CPU limit.
    98              # See:
    99              #   https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#static-policy
   100              #   https://github.com/kubernetes/kubernetes/issues/51135
   101              #cpu: "16"
   102              memory: "8Gi"
   103          ports:
   104          - containerPort: 26257
   105            hostPort: 26257
   106            name: grpc
   107          - containerPort: 8080
   108            hostPort: 8080
   109            name: http
   110          livenessProbe:
   111            httpGet:
   112              path: "/health"
   113              port: http
   114              scheme: HTTP
   115            initialDelaySeconds: 30
   116            periodSeconds: 5
   117          readinessProbe:
   118            httpGet:
   119              path: "/health?ready=1"
   120              port: http
   121              scheme: HTTP
   122            initialDelaySeconds: 10
   123            periodSeconds: 5
   124            failureThreshold: 2
   125          volumeMounts:
   126          - name: datadir
   127            mountPath: /cockroach/cockroach-data
   128          env:
   129          - name: COCKROACH_CHANNEL
   130            value: kubernetes-insecure
   131          command:
   132            - "/bin/bash"
   133            - "-ecx"
   134            # TODO: Replace "YOUR_IP_ADDR1_HERE,YOUR_IP_ADDR2_HERE,YOUR_IP_ADDR3_HERE" with a list of a few of the IP addresses of the machines on which CockroachDB will be running.
   135            - "exec /cockroach/cockroach start --logtostderr --insecure --http-addr 0.0.0.0 --cache 25% --max-sql-memory 25% --join=YOUR_IP_ADDR1_HERE,YOUR_IP_ADDR2_HERE,YOUR_IP_ADDR3_HERE"
   136        terminationGracePeriodSeconds: 60
   137        volumes:
   138        - name: datadir
   139          hostPath:
   140            # TODO: Replace "YOUR_FILESYSTEM_PATH_HERE" with the path where you want CockroachDB's data stored on your Kubernetes nodes.
   141            path: YOUR_FILESYSTEM_PATH_HERE