You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Resource Management with the Kubernetes Operator
3
-
summary: Allocate CPU, memory, and storage resources for a cluster deployed with the Kubernetes Operator.
2
+
title: Resource Management with the CockroachDB Operator
3
+
summary: Allocate CPU, memory, and storage resources for a cluster deployed with the CockroachDB operator.
4
4
toc: true
5
5
toc_not_nested: true
6
6
secure: true
@@ -25,7 +25,7 @@ You can set the CPU and memory resources allocated to the CockroachDB container
25
25
26
26
Specify CPU and memory values in `cockroachdb.crdbCluster.resources.limits` and `cockroachdb.crdbCluster.resources.requests` in the values file used to [deploy the cluster](deploy-cockroachdb-with-kubernetes-operator.html#initialize-the-cluster):
We recommend using identical values for `resources.requests` and `resources.limits`. When setting the new values, note that not all of a pod's resources will be available to the CockroachDB container. This is because a fraction of the CPU and memory is reserved for Kubernetes.
47
+
Cockroach Labs recommends using identical values for `resources.requests` and `resources.limits`. When setting the new values, note that not all of a pod's resources will be available to the CockroachDB container. This is because a fraction of the CPU and memory is reserved for Kubernetes.
47
48
48
49
{{site.data.alerts.callout_info}}
49
50
If no resource limits are specified, the pods will be able to consume the maximum available CPUs and memory. However, to avoid overallocating resources when another memory-intensive workload is on the same instance, always set resource requests and limits explicitly.
@@ -55,15 +56,15 @@ For more information on how Kubernetes handles resources, see the [Kubernetes do
55
56
56
57
Each CockroachDB node reserves a portion of its available memory for its cache and for storing temporary data for SQL queries. For more information on these settings, see the [Production Checklist](recommended-production-settings.html#cache-and-sql-memory-size).
57
58
58
-
The Kubernetes operator dynamically sets cache size and SQL memory size each to 25% (the recommended percentage) of the available memory, which depends on the memory request and limit you [specified](#memory-and-cpu) for your configuration. These values can be modified by adding the `cache` or `max-sql-memory` fields to `cockroachdb.crdbCluster.flags`, which is equivalent to appending `--cache` or `--max-sql-memory` as [cockroach start flags](cockroach-start.html#flags).
59
+
The CockroachDB operator dynamically sets cache size and SQL memory size each to 25% (the recommended percentage) of the available memory, which depends on the memory request and limit you [specified](#memory-and-cpu) for your configuration. These values can be modified by adding the `cache` or `max-sql-memory` fields to `cockroachdb.crdbCluster.flags`, which is equivalent to appending `--cache` or `--max-sql-memory` as [cockroach start flags](cockroach-start.html#flags).
59
60
60
61
## Persistent storage
61
62
62
63
When you start your cluster, Kubernetes dynamically provisions and mounts a persistent volume into each pod. For more information on persistent volumes, see the [Kubernetes documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes/).
63
64
64
65
The storage capacity of each volume is set in `cockroachdb.crdbCluster.dataStore.volumeClaimTemplate.spec.resources` in the values file used to [deploy the cluster](deploy-cockroachdb-with-kubernetes-operator.html#initialize-the-cluster):
65
66
66
-
```yaml
67
+
~~~yaml
67
68
cockroachdb:
68
69
crdbCluster:
69
70
dataStore:
@@ -72,7 +73,7 @@ cockroachdb:
72
73
resources:
73
74
requests:
74
75
storage: "10Gi"
75
-
```
76
+
~~~
76
77
77
78
You should provision an appropriate amount of disk storage for your workload. For recommendations on this, see the [Production Checklist](recommended-production-settings.html#storage).
78
79
@@ -82,7 +83,7 @@ If you discover that you need more capacity, you can expand the persistent volum
82
83
83
84
Specify a new volume size in the values file used to [deploy the cluster](deploy-cockroachdb-with-kubernetes-operator.html#initialize-the-cluster):
The Operator updates all nodes and triggers a rolling restart of the pods with the new storage capacity.
104
+
The CockroachDB operator updates all nodes and triggers a rolling restart of the pods with the new storage capacity.
103
105
104
106
To verify that the storage capacity has been updated, run `kubectl get pvc` to view the persistent volume claims (PVCs). It will take a few minutes before the PVCs are completely updated.
105
107
106
108
## Network ports
107
109
108
-
The Operator separates network traffic into three ports:
109
-
110
-
<table>
111
-
<tr>
112
-
<th>Protocol
113
-
</td>
114
-
<td><strong>Default</strong>
115
-
</td>
116
-
<td><strong>Description</strong>
117
-
</td>
118
-
<td><strong>Custom Resource Field</strong>
119
-
</td>
120
-
</tr>
121
-
<tr>
122
-
<td>gRPC
123
-
</td>
124
-
<td>26258
125
-
</td>
126
-
<td>Used for node connections
127
-
</td>
128
-
<td><code>service.ports.grpc</code>
129
-
</td>
130
-
</tr>
131
-
<tr>
132
-
<td>HTTP
133
-
</td>
134
-
<td>8080
135
-
</td>
136
-
<td>Used to <a href="ui-overview.html#db-console-access">access the DB Console</a>
137
-
</td>
138
-
<td><code>service.ports.http</code>
139
-
</td>
140
-
</tr>
141
-
<tr>
142
-
<td>SQL
143
-
</td>
144
-
<td>26257
145
-
</td>
146
-
<td>Used for SQL shell access
147
-
</td>
148
-
<td><code>service.ports.sql</code>
149
-
</td>
150
-
</tr>
151
-
</table>
152
-
153
-
Specify alternate port numbers in `cockroachdb.crdbCluster.service.ports` of the Operator's [custom resource](deploy-cockroachdb-with-kubernetes-operator.html#initialize-the-cluster) (for example, to match the default port `5432` on PostgreSQL):
154
-
155
-
```yaml
110
+
The CockroachDB operator separates network traffic into three ports:
| gRPC | 26258 | Used for node connections | service.ports.grpc |
115
+
| HTTP | 8080 | Used to access the DB Console | service.ports.http |
116
+
| SQL | 26257 | Used for SQL shell access | service.ports.sql |
117
+
118
+
Specify alternate port numbers in `cockroachdb.crdbCluster.service.ports` of the CockroachDB operator's [custom resource](deploy-cockroachdb-with-kubernetes-operator.html#initialize-the-cluster) (for example, to match the default port `5432` on PostgreSQL):
0 commit comments