/crdb-k8s-statefulset

Kubernetes StatefulSet CockroachDB Deployment (single region, GCP)

Primary LanguageShell

Kubernetes StatefulSet CockroachDB Deployment (single region, GCP)

This repo just contains scripts to help deploy CockroachDB onto GKE, per this doc, with the addition of:

Script for a demo (you can vary to suit your goals)

Note: over time, parts of this may change and need to be updated; for example:

  • CockroachDB versions
  • Geo Tourist app version
  • Documentation links

Overall set up of GKE and CockroachDB clusters

  1. 00_setup_gke.sh: Set up your GKE cluster. Note the prerequisites listed in this document
  2. 01_gen_certs.sh: Generate the required SSL certificates and create the required K8s secrets
  3. 02_apply_stateful_set.sh: Applying CockroachDB stateful set configuration; when ready, it will print the public IP address which can be used to connect via SQL client of web browser, for DB Console (port 8080)
  4. 03_sql_client.sh: Start a SQL client pod and use it to create a demouser account in CockroachDB
  5. 04_pgweb_start.sh: Use the PGWeb SQL UI to access the CockroachDB cluster as demouser

Option A: Run cockroach workload against that CockroachDB cluster

  1. Specify the time in minutes to run the workload: export WORKLOAD_RUN_MINUTES=15
  2. 06_run_workload.sh: Runs cockroach workload bank for the specified duration (the script runs it all for you)

Option B: Deploy the Geo Tourist demo against that CockroachDB cluster

  1. 08_geo_load_data.sh: Deploy the data loader app which creates tables and loads data
  2. 09_geo_app_start.sh: Deploy the app itself; when finished, it will print the public IP address of the app

Day two operations

  1. 10_scale_out.sh: Add a 4th node to the CockroachDB cluster (zero down time)
  2. 11_rolling_upgrade.sh: Perform a zero downtime rolling upgrade of the CockroachDB cluster
  3. 12_kill_a_node.sh: Kill one of the CockroachDB nodes and observe effects via DB Console and/or the app
  4. 13_psql_cli.sh: Use the psql CLI to connect to the CockroachDB cluster
  5. 14_create_backup_schedule.sh: Create a backup schedule for defaultdb. When this script is run, it outputs a list of requirements (Enterprise license, Cloud Storage bucket, service account with key).

Clean it all up

  1. 20_clean_up.sh: Clean up the app and the CockroachDB components
  2. 21_gke_delete_cluster.sh: Delete the GKE cluster itself