text stringlengths 0 59.1k |
|---|
mountPath: "/cockroach/cockroach-data" |
affinity: |
podAntiAffinity: |
preferredDuringSchedulingIgnoredDuringExecution: |
- weight: 100 |
podAffinityTerm: |
labelSelector: |
matchExpressions: |
- key: app |
operator: In |
values: |
- cockroachdb |
topologyKey: kubernetes.io/hostname |
containers: |
- name: cockroachdb |
image: cockroachdb/cockroach:v1.1.0 |
imagePullPolicy: IfNotPresent |
ports: |
- containerPort: 26257 |
name: grpc |
- containerPort: 8080 |
name: http |
volumeMounts: |
- name: datadir |
mountPath: /cockroach/cockroach-data |
command: |
- "/bin/bash" |
- "-ecx" |
- | |
# The use of qualified `hostname -f` is crucial: |
# Other nodes aren't able to look up the unqualified hostname. |
CRARGS=("start" "--logtostderr" "--insecure" "--host" "$(hostname -f)" "--http-host" "0.0.0.0") |
# We only want to initialize a new cluster (by omitting the join flag) |
# if we're sure that we're the first node (i.e. index 0) and that |
# there aren't any other nodes running as part of the cluster that |
# this is supposed to be a part of (which indicates that a cluster |
# already exists and we should make sure not to create a new one). |
# It's fine to run without --join on a restart if there aren't any |
# other nodes. |
if [ ! "$(hostname)" == "cockroachdb-0" ] || \ |
[ -e "/cockroach/cockroach-data/cluster_exists_marker" ] |
then |
# We don't join cockroachdb in order to avoid a node attempting |
# to join itself, which currently doesn't work |
# (https://github.com/cockroachdb/cockroach/issues/9625). |
CRARGS+=("--join" "cockroachdb-public") |
fi |
exec /cockroach/cockroach ${CRARGS[*]} |
# No pre-stop hook is required, a SIGTERM plus some time is all that's |
# needed for graceful shutdown of a node. |
terminationGracePeriodSeconds: 60 |
volumes: |
- name: datadir |
persistentVolumeClaim: |
claimName: datadir |
volumeClaimTemplates: |
- metadata: |
name: datadir |
spec: |
accessModes: |
- "ReadWriteOnce" |
resources: |
requests: |
storage: 1Gi |
<|endoftext|> |
# source: k8s_examples/_archived/cockroachdb/README.md type: docs |
# CockroachDB on Kubernetes as a StatefulSet |
This example deploys [CockroachDB](https://cockroachlabs.com) on Kubernetes as |
a StatefulSet. CockroachDB is a distributed, scalable NewSQL database. Please see |
[the homepage](https://cockroachlabs.com) and the |
[documentation](https://www.cockroachlabs.com/docs/) for details. |
## Limitations |
### StatefulSet limitations |
Standard StatefulSet limitations apply: There is currently no possibility to use |
node-local storage (outside of single-node tests), and so there is likely |
a performance hit associated with running CockroachDB on some external storage. |
Note that CockroachDB already does replication and thus it is unnecessary to |
deploy it onto persistent volumes which already replicate internally. |
For this reason, high-performance use cases on a private Kubernetes cluster |
may want to consider a DaemonSet deployment until Stateful Sets support node-local |
storage (see #7562). |
### Recovery after persistent storage failure |
A persistent storage failure (e.g. losing the hard drive) is gracefully handled |
by CockroachDB as long as enough replicas survive (two out of three by |
default). Due to the bootstrapping in this deployment, a storage failure of the |
first node is special in that the administrator must manually prepopulate the |
"new" storage medium by running an instance of CockroachDB with the `--join` |
parameter. If this is not done, the first node will bootstrap a new cluster, |
which will lead to a lot of trouble. |
### Dynamic volume provisioning |
The deployment is written for a use case in which dynamic volume provisioning is |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.