Skip to content

Commit 0e37f63

Browse files
committed
Update CRDB operator examples and instructions for deprecated fields
Pritesh feedback Refactor example and override doc to not require container field Additional Pritesh feedback
1 parent 20a9439 commit 0e37f63

File tree

5 files changed

+182
-165
lines changed

5 files changed

+182
-165
lines changed

src/current/v26.1/cockroachdb-operator-performance.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,12 @@ Once you've picked out an amount of CPU and memory to reserve for Cockroach, con
177177
~~~ yaml
178178
cockroachdb:
179179
crdbCluster:
180-
resources:
181-
requests:
182-
cpu: 3500m
183-
memory: 12300Mi
180+
podTemplate:
181+
spec:
182+
resources:
183+
requests:
184+
cpu: 3500m
185+
memory: 12300Mi
184186
~~~
185187

186188
When you initialize the cluster, check that all the CockroachDB pods are scheduled successfully. If you see any get stuck in the pending state, run `kubectl describe pod {podname}` and check the `Events` for information about why they're still pending. You may need to manually preempt pods on one or more nodes by running `kubectl delete pod` on them to make room for the CockroachDB pods. As long as the pods you delete were created by a higher-level Kubernetes object such as a `Deployment`, they'll be safely recreated on another node.
@@ -194,12 +196,14 @@ To set resource limits, in addition to the [resource requests](#resource-request
194196
~~~ yaml
195197
cockroachdb:
196198
crdbCluster:
197-
resources:
198-
requests:
199-
cpu: 3500m
200-
memory: 12300Mi
201-
limits:
202-
memory: 12300Mi
199+
podTemplate:
200+
spec:
201+
resources:
202+
requests:
203+
cpu: 3500m
204+
memory: 12300Mi
205+
limits:
206+
memory: 12300Mi
203207
~~~
204208

205209
Pods will be limited to their reserved resources and are unlikely to be preempted, except in rare cases. This will not improve performance on an underutilized Kubernetes cluster, but provides more predictable performance as other workloads run.
@@ -266,27 +270,29 @@ Client applications such as benchmarking applications running on the same machin
266270
~~~ yaml
267271
cockroachdb:
268272
crdbCluster:
269-
affinity:
270-
podAntiAffinity:
271-
preferredDuringSchedulingIgnoredDuringExecution:
272-
- weight: 100
273-
podAffinityTerm:
274-
labelSelector:
275-
matchExpressions:
276-
- key: app
277-
operator: In
278-
values:
279-
- loadgen
280-
topologyKey: kubernetes.io/hostname
281-
- weight: 99
282-
podAffinityTerm:
283-
labelSelector:
284-
matchExpressions:
285-
- key: app
286-
operator: In
287-
values:
288-
- cockroachdb
289-
topologyKey: kubernetes.io/hostname
273+
podTemplate:
274+
spec:
275+
affinity:
276+
podAntiAffinity:
277+
preferredDuringSchedulingIgnoredDuringExecution:
278+
- weight: 100
279+
podAffinityTerm:
280+
labelSelector:
281+
matchExpressions:
282+
- key: app
283+
operator: In
284+
values:
285+
- loadgen
286+
topologyKey: kubernetes.io/hostname
287+
- weight: 99
288+
podAffinityTerm:
289+
labelSelector:
290+
matchExpressions:
291+
- key: app
292+
operator: In
293+
values:
294+
- cockroachdb
295+
topologyKey: kubernetes.io/hostname
290296
~~~
291297

292298
The preceding configuration will first prefer to put the `loadgen` pods on different nodes from each other, which is important for the fault tolerance of the `loadgen` pods themselves. As a secondary priority, it will attempt to put the pods on nodes that do not already have a running `CockroachDB` pod. This will ensure the best possible balance of fault tolerance and performance for the load generator and CockroachDB cluster.

src/current/v26.1/configure-cockroachdb-operator.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,20 @@ You can set the CPU and memory resources allocated to the CockroachDB container
2727
1 CPU in Kubernetes is equivalent to 1 vCPU or 1 hyperthread. For best practices on provisioning CPU and memory for CockroachDB, refer to the [Production Checklist]({% link {{ page.version.version }}/recommended-production-settings.md %}#hardware).
2828
{{site.data.alerts.end}}
2929

30-
Specify CPU and memory values in `cockroachdb.crdbCluster.resources.limits` and `cockroachdb.crdbCluster.resources.requests` in the values file used to [deploy the cluster]({% link {{ page.version.version }}/deploy-cockroachdb-with-cockroachdb-operator.md %}#initialize-the-cluster):
30+
Specify CPU and memory values in `cockroachdb.crdbCluster.podTemplate.spec.resources.limits` and `cockroachdb.crdbCluster.podTemplate.spec.resources.requests` in the values file used to [deploy the cluster]({% link {{ page.version.version }}/deploy-cockroachdb-with-cockroachdb-operator.md %}#initialize-the-cluster):
3131

3232
~~~ yaml
3333
cockroachdb:
3434
crdbCluster:
35-
resources:
36-
limits:
37-
cpu: 4000m
38-
memory: 16Gi
39-
requests:
40-
cpu: 4000m
41-
memory: 16Gi
35+
podTemplate:
36+
spec:
37+
resources:
38+
limits:
39+
cpu: 4000m
40+
memory: 16Gi
41+
requests:
42+
cpu: 4000m
43+
memory: 16gi
4244
~~~
4345

4446
Apply the new settings to the cluster:

src/current/v26.1/deploy-cockroachdb-with-cockroachdb-operator.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,21 @@ For bare metal deployments, the specific Kubernetes infrastructure deployment st
252252
If you intend to deploy CockroachDB nodes across multiple different regions, follow the additional steps described in [Deploy across multiple regions](#deploy-across-multiple-regions).
253253
{{site.data.alerts.callout_end}}
254254

255-
1. Uncomment and modify `cockroachdb.crdbCluster.resources` in the values file with the CPU and memory requests and limits for each node to use. The default values are 4vCPU and 16GiB of memory:
255+
1. Modify `cockroachdb.crdbCluster.podTemplate.spec.resources` in the values file with the CPU and memory limits and requests for each node to use. For example, to define default values of 4vCPU and 16GiB of memory:
256+
257+
~~~ yaml
258+
cockroachdb:
259+
crdbCluster:
260+
podTemplate:
261+
spec:
262+
resources:
263+
limits:
264+
cpu: 4000m
265+
memory: 16Gi
266+
requests:
267+
cpu: 4000m
268+
memory: 16gi
269+
~~~
256270

257271
For more information on configuring node resource allocation, refer to [Resource management]({% link {{ page.version.version }}/configure-cockroachdb-operator.md %})
258272

@@ -302,13 +316,18 @@ For bare metal deployments, the specific Kubernetes infrastructure deployment st
302316
cockroach start --locality region=us-central1,zone=us-central1-c,dc=dc2
303317
~~~
304318
305-
Optionally, review the `cockroachdb.crdbCluster.topologySpreadConstraints` configuration and set `topologyKey` to the `nodeLabel` value of a locality level that has distinct values for each node. By default the lowest locality level is `zone`, so the following configuration sets that value as the `topologyKey`:
319+
Optionally, review the `cockroachdb.crdbCluster.podTemplate.spec.topologySpreadConstraints` configuration and set `topologyKey` to the `nodeLabel` value of a locality level that has distinct values for each node. By default the lowest locality level is `zone`, so the following configuration sets that value as the `topologyKey`:
306320
307321
~~~ yaml
308322
cockroachdb:
309323
crdbCluster:
310-
topologySpreadConstraints:
311-
topologyKey: topology.kubernetes.io/zone
324+
podTemplate:
325+
spec:
326+
topologySpreadConstraints:
327+
# maxSkew defines the degree to which the pods can be unevenly distributed.
328+
- maxSkew: 1
329+
# topologyKey defines the key for topology spread.
330+
topologyKey: topology.kubernetes.io/zone
312331
~~~
313332
314333
For more information on localities and topology planning, see the [topology patterns documentation]({% link {{ page.version.version }}/topology-patterns.md %}).

src/current/v26.1/override-templates-cockroachdb-operator.md

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The {{ site.data.products.cockroachdb-operator }} provides abstractions that sim
1010
- A default pod specification is used for the CockroachDB Kubernetes pod.
1111
- The `values.yaml` configuration maps to a subset of `cockroach start` flags when CockroachDB is initialized.
1212

13-
This page describes configuration options that allow advanced users to manually override the pod template and `cockroach start` flags as needed for deployment.
13+
This page describes configuration options that allow advanced users to manually override pod template metadata and `cockroach start` flags as needed for deployment.
1414

1515
{{site.data.alerts.callout_info}}
1616
The {{ site.data.products.cockroachdb-operator }} is in [Preview]({% link {{ page.version.version }}/cockroachdb-feature-availability.md %}).
@@ -24,6 +24,8 @@ This page describes advanced configurations that override the supported default
2424

2525
The `cockroachdb.crdbCluster.podTemplate` field allows you to override the default pod metadata and specification configured by the {{ site.data.products.cockroachdb-operator }}. The values in this field are merged with the default pod specification, where settings in `podTemplate` override any values in the default.
2626

27+
The `podTemplate` field includes a `containers` field that specifies the container name and image that the template is applied to. By default, this resolves to the `cockroachdb` container name and can be excluded from modifications to the CockroachDB pod template YAML. If needed, you can provide specific images for the `containers` and `initContainers`. For example, the following `podTemplate` configuration specifies a custom init container:
28+
2729
~~~ yaml
2830
cockroachdb:
2931
crdbCluster:
@@ -35,37 +37,7 @@ cockroachdb:
3537
# initContainers captures the list of init containers for CockroachDB pods.
3638
initContainers:
3739
- name : cockroachdb-init
38-
image: us-docker.pkg.dev/cockroach-cloud-images/data-plane/init-container@sha256:c3e4ba851802a429c7f76c639a64b9152d206cebb31162c1760f05e98f7c4254
39-
# containers captures the list of containers for CockroachDB pods.
40-
containers:
41-
- name: cockroachdb
42-
image: cockroachdb/cockroach:v25.4.0
43-
# imagePullSecrets captures the secrets for fetching images from private registries.
44-
imagePullSecrets: []
45-
~~~
46-
47-
At least one value for `containers` must be specified if any part of `podTemplate` is being modified. For example, the following `podTemplate` configuration overrides pod anti-affinity behavior and specifies a default `cockroachdb/cockroach:v25.4.0` container image:
48-
49-
~~~ yaml
50-
cockroachdb:
51-
crdbCluster:
52-
podTemplate:
53-
spec:
54-
affinity:
55-
podAntiAffinity:
56-
preferredDuringSchedulingIgnoredDuringExecution:
57-
- weight: 100
58-
podAffinityTerm:
59-
labelSelector:
60-
matchExpressions:
61-
- key: app.kubernetes.io/component
62-
operator: In
63-
values:
64-
- cockroachdb
65-
topologyKey: kubernetes.io/hostname
66-
containers:
67-
- name: cockroachdb
68-
image: cockroachdb/cockroach:v25.4.0
40+
image: us-docker.pkg.dev/cockroach-cloud-images/data-plane/init-container@sha256:example1234567890abcdefghijklmnopqrstuvwxyz
6941
~~~
7042

7143
## Override the default `cockroach start` flags

0 commit comments

Comments
 (0)