{"id":23590819,"url":"https://github.com/utilitywarehouse/cockroachdb-manifests","last_synced_at":"2025-05-07T16:20:58.246Z","repository":{"id":39709031,"uuid":"188234483","full_name":"utilitywarehouse/cockroachdb-manifests","owner":"utilitywarehouse","description":"Kustomize templates for cockroachdb deployment.","archived":false,"fork":false,"pushed_at":"2024-10-29T09:19:35.000Z","size":172,"stargazers_count":5,"open_issues_count":0,"forks_count":5,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-03-31T11:51:08.277Z","etag":null,"topics":["cockroachdb","kubernetes","kustomize","manifests"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/utilitywarehouse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-23T12:57:15.000Z","updated_at":"2024-10-29T09:19:37.000Z","dependencies_parsed_at":"2024-01-31T16:59:27.662Z","dependency_job_id":"c4ecef6a-9461-4166-86cd-b0a9be8553ff","html_url":"https://github.com/utilitywarehouse/cockroachdb-manifests","commit_stats":null,"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utilitywarehouse%2Fcockroachdb-manifests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utilitywarehouse%2Fcockroachdb-manifests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utilitywarehouse%2Fcockroachdb-manifests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utilitywarehouse%2Fcockroachdb-manifests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utilitywarehouse","download_url":"https://codeload.github.com/utilitywarehouse/cockroachdb-manifests/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252913051,"owners_count":21824092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cockroachdb","kubernetes","kustomize","manifests"],"created_at":"2024-12-27T07:15:48.688Z","updated_at":"2025-05-07T16:20:58.226Z","avatar_url":"https://github.com/utilitywarehouse.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"**CockroachDB manifests are moved to [shared-kustomize-bases](https://github.com/utilitywarehouse/shared-kustomize-bases/tree/main/cockroachdb)**\n\nPlease, do not contribute to this repository, and do not use\nit for the new Cockroach instances.\n\nIt's not archived just to not break the OpsLevel integration for services using it.\n\n\n# cockroachdb-manifests\n\nThis is a Kustomization base for deploying CockroachDB to a Kubernetes cluster. The base depends on [cert-manager](https://github.com/cert-manager/cert-manager) for generating and renewing certificates to secure communication between nodes and clients.\n\n## Deployment\n\nTo deploy a cockroachdb cluster in your namespace you will need to setup a `kustomization.yaml` file that will use the bases defined here with your own configuration layered over the top. There is an [examples](./examples/) folder that can be used as a starting point. By filling in the missing pieces (e.g. certs, backup config, etc) you should get a running CRDB cluster with periodic backups to S3 and AWS creds injected via [vault](https://github.com/utilitywarehouse/documentation/blob/master/infra/vault/vault-aws.md) (assumes an existing vault setup).\n\n### Single namespace - multiple CockroachDB clusters\n\nWhile the preference is to have a single CockroachDB cluster per namespace, in some cases this isn't ideal. \n\nAn example of this is in the Energy team where they have recently split into three squads but currently still share use of the `energy-platform` namespace. \n\nIn order to deploy multiple CockroachDB clusters within a single namespace whilst avoiding naming conflicts we can make use of the `namePrefix` and/or `nameSuffix` ability of Kustomize. \nThis will automagically update the names of resources within a Kustomization as well as the selectors and labels. \n\nOne part of this that Kustomize is not able to help with is with the CockroachDB specific commands that are used to create and join nodes to the cluster. \nFor this two environment variables have been added `COCKROACH_INIT_HOST` and `COCKROACH_JOIN_STRING`. \n\n- `COCKROACH_INIT_HOST` is used by the `init-job.yaml` manifest to initialise the first node in the cluster\n- `COCKROACH_JOIN_STRING` is in the `statefulset.yaml` manifest to define which nodes will be joining the cluster. \n\nThere are sensible defaults for these environment variables to ensure that a single cluster within a namespace can be brought up without overriding any environment variables. \n\n\n### Versioning\n\nThis repo uses tags to manage versions, these tags have two components:\n\n  - The version of the `cockroachdb/cockroach` image the manifests are using\n  - An internal version to track changes to anything besides the version of\n    CockroachDB\n\nThese tags are of the form `\u003ccockroachdb-version\u003e-\u003cinternal-version\u003e`, for\nexample: `v23.1.10-2` is the 2nd internal version of these manifests supporting\n`cockroachdb/cockroachv:23.1.10`\n\n### Configuration\nCockroach DB requires some base configuration that can be overridden. (An example is below)\n- Note: `cockroach.host` and `cockroach.port` are required by the backup job.\n```\ncockroach.host=cockroachdb-proxy\ncockroach.port=26257\n```\n\n#### CockroachDB\n\nYou can configure `--cache` and `--max-sql-memory` cockroachdb flags via\nfollowing envvars: `CACHE` and `MAX_SQL_MEMORY`.\n\n### Client\n\n- The base provides a client deployment that bootstraps the Cockroach sql command.\n- The client deployment is useful for debugging issues and communicating with Cockroach.\n- An example command for starting a sql shell is `kubectl exec -it deployment/cockroachdb-client -c cockroachdb-client -- cockroach sql`\n\n### Admin UI\n\nIn order to access admin UI, Port forward port 8080 on one of the cockroachdb- pods,\nthen navigate to https://localhost:8080/\n\n### DB Console\n\nCockroachDB has a DB console [user interface](https://www.cockroachlabs.com/docs/stable/ui-overview.html).\nTo log into the DB console you will require a database user.\nThis can be achieved by:\n- Start a SQL shell using the client `kubectl exec -it deployment/cockroachdb-client -c cockroachdb-client -- cockroach sql`\n  - You may need to change the replica count of the client (see above)\n- Create a user using SQL `CREATE USER foo WITH PASSWORD 'changeme';`\n- Assign admin role to the user with the SQL command `GRANT admin TO foo;`\n  - This allows full access within the UI.\n- Port forward any node `kubectl port-forward cockroachdb-0 8080`\n- Use a browser to navigate to https://localhost:8080.\n- It will warn you that the certificate is not trusted, this is expected.\n\n### Architecture\nWe recommend creating one instance of CockroachDB cluster per namespace instead of creating new cluster instance\nfor each of applications.\nData can be separated by creating different databases, and having one, bigger cluster instead of multiple smaller ones\nreduces infrastructure costs and maintenance overhead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futilitywarehouse%2Fcockroachdb-manifests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futilitywarehouse%2Fcockroachdb-manifests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futilitywarehouse%2Fcockroachdb-manifests/lists"}