Skip to content

Commit aab4d2f

Browse files
committed
Update k8s tutorials
- Use helm upgrade for adding and removing nodes and cluster upgrades - Correct downgrade option for 19.1 k8s upgrade - Wrap commands to be more visible Fixes #4689.
1 parent d34cb19 commit aab4d2f

14 files changed

+512
-113
lines changed

_includes/metric-names.md

Lines changed: 246 additions & 0 deletions
Large diffs are not rendered by default.

_includes/v19.1/orchestration/kubernetes-prometheus-alertmanager.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ If you're on Hosted GKE, before starting, make sure the email address associated
4242
4343
{% include copy-clipboard.html %}
4444
~~~ shell
45-
$ kubectl apply -f https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.20/bundle.yaml
45+
$ kubectl apply \
46+
-f https://raw.githubusercontent.com/coreos/prometheus-operator/release-0.20/bundle.yaml
4647
~~~
4748
4849
~~~
@@ -68,7 +69,8 @@ If you're on Hosted GKE, before starting, make sure the email address associated
6869
6970
{% include copy-clipboard.html %}
7071
~~~ shell
71-
$ kubectl apply -f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/prometheus/prometheus.yaml
72+
$ kubectl apply \
73+
-f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/prometheus/prometheus.yaml
7274
~~~
7375
7476
~~~
@@ -115,7 +117,8 @@ Active monitoring helps you spot problems early, but it is also essential to sen
115117

116118
{% include copy-clipboard.html %}
117119
~~~ shell
118-
$ kubectl create secret generic alertmanager-cockroachdb --from-file=alertmanager.yaml=alertmanager-config.yaml
120+
$ kubectl create secret generic alertmanager-cockroachdb \
121+
--from-file=alertmanager.yaml=alertmanager-config.yaml
119122
~~~
120123

121124
~~~
@@ -139,7 +142,8 @@ Active monitoring helps you spot problems early, but it is also essential to sen
139142

140143
{% include copy-clipboard.html %}
141144
~~~ shell
142-
$ kubectl apply -f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/prometheus/alertmanager.yaml
145+
$ kubectl apply \
146+
-f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/prometheus/alertmanager.yaml
143147
~~~
144148

145149
~~~
@@ -168,7 +172,8 @@ Active monitoring helps you spot problems early, but it is also essential to sen
168172
169173
{% include copy-clipboard.html %}
170174
~~~ shell
171-
$ kubectl apply -f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/prometheus/alert-rules.yaml
175+
$ kubectl apply \
176+
-f https://raw.githubusercontent.com/cockroachdb/cockroach/master/cloud/kubernetes/prometheus/alert-rules.yaml
172177
~~~
173178
174179
~~~

_includes/v19.1/orchestration/kubernetes-remove-nodes-insecure.md

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
To safely remove a node from your cluster, you must first decommission the node and only then adjust the `--replicas` value of your StatefulSet configuration to permanently remove it. This sequence is important because the decommissioning process lets a node finish in-flight requests, rejects any new requests, and transfers all range replicas and range leases off the node.
1+
To safely remove a node from your cluster, you must first decommission the node and only then adjust the `Replicas` value of your StatefulSet configuration to permanently remove it. This sequence is important because the decommissioning process lets a node finish in-flight requests, rejects any new requests, and transfers all range replicas and range leases off the node.
22

33
{{site.data.alerts.callout_danger}}
44
If you remove nodes without first telling CockroachDB to decommission them, you may cause data or even cluster unavailability. For more details about how this works and what to consider before removing nodes, see [Decommission Nodes](remove-nodes.html).
@@ -9,17 +9,22 @@ If you remove nodes without first telling CockroachDB to decommission them, you
99
<section class="filter-content" markdown="1" data-scope="manual">
1010
{% include copy-clipboard.html %}
1111
~~~ shell
12-
$ kubectl run cockroachdb -it --image=cockroachdb/cockroach --rm --restart=Never \
13-
-- node status --insecure --host=cockroachdb-public
12+
$ kubectl run cockroachdb -it \
13+
--image=cockroachdb/cockroach:{{page.release_info.version}} \
14+
--rm \
15+
--restart=Never \
16+
-- node status \
17+
--insecure \
18+
--host=cockroachdb-public
1419
~~~
1520

1621
~~~
1722
id | address | build | started_at | updated_at | is_available | is_live
1823
+----+---------------------------------------------------------------------------------+--------+----------------------------------+----------------------------------+--------------+---------+
19-
1 | cockroachdb-0.cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:04:36.486082+00:00 | 2018-11-29 18:24:24.587454+00:00 | true | true
20-
2 | cockroachdb-2.cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:55:03.880406+00:00 | 2018-11-29 18:24:23.469302+00:00 | true | true
21-
3 | cockroachdb-1.cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:04:41.383588+00:00 | 2018-11-29 18:24:25.030175+00:00 | true | true
22-
4 | cockroachdb-3.cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 17:31:19.990784+00:00 | 2018-11-29 18:24:26.041686+00:00 | true | true
24+
1 | cockroachdb-0.cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:04:36.486082+00:00 | 2018-11-29 18:24:24.587454+00:00 | true | true
25+
2 | cockroachdb-2.cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:55:03.880406+00:00 | 2018-11-29 18:24:23.469302+00:00 | true | true
26+
3 | cockroachdb-1.cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:04:41.383588+00:00 | 2018-11-29 18:24:25.030175+00:00 | true | true
27+
4 | cockroachdb-3.cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 17:31:19.990784+00:00 | 2018-11-29 18:24:26.041686+00:00 | true | true
2328
(4 rows)
2429
~~~
2530

@@ -28,17 +33,22 @@ If you remove nodes without first telling CockroachDB to decommission them, you
2833
<section class="filter-content" markdown="1" data-scope="helm">
2934
{% include copy-clipboard.html %}
3035
~~~ shell
31-
$ kubectl run cockroachdb -it --image=cockroachdb/cockroach --rm --restart=Never \
32-
-- node status --insecure --host=my-release-cockroachdb-public
36+
$ kubectl run cockroachdb -it \
37+
--image=cockroachdb/cockroach:{{page.release_info.version}} \
38+
--rm \
39+
--restart=Never \
40+
-- node status \
41+
--insecure \
42+
--host=my-release-cockroachdb-public
3343
~~~
3444

3545
~~~
3646
id | address | build | started_at | updated_at | is_available | is_live
3747
+----+---------------------------------------------------------------------------------+--------+----------------------------------+----------------------------------+--------------+---------+
38-
1 | my-release-cockroachdb-0.my-release-cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:04:36.486082+00:00 | 2018-11-29 18:24:24.587454+00:00 | true | true
39-
2 | my-release-cockroachdb-2.my-release-cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:55:03.880406+00:00 | 2018-11-29 18:24:23.469302+00:00 | true | true
40-
3 | my-release-cockroachdb-1.my-release-cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:04:41.383588+00:00 | 2018-11-29 18:24:25.030175+00:00 | true | true
41-
4 | my-release-cockroachdb-3.my-release-cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 17:31:19.990784+00:00 | 2018-11-29 18:24:26.041686+00:00 | true | true
48+
1 | my-release-cockroachdb-0.my-release-cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:04:36.486082+00:00 | 2018-11-29 18:24:24.587454+00:00 | true | true
49+
2 | my-release-cockroachdb-2.my-release-cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:55:03.880406+00:00 | 2018-11-29 18:24:23.469302+00:00 | true | true
50+
3 | my-release-cockroachdb-1.my-release-cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:04:41.383588+00:00 | 2018-11-29 18:24:25.030175+00:00 | true | true
51+
4 | my-release-cockroachdb-3.my-release-cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 17:31:19.990784+00:00 | 2018-11-29 18:24:26.041686+00:00 | true | true
4252
(4 rows)
4353
~~~
4454
</section>
@@ -52,16 +62,26 @@ If you remove nodes without first telling CockroachDB to decommission them, you
5262
<section class="filter-content" markdown="1" data-scope="manual">
5363
{% include copy-clipboard.html %}
5464
~~~ shell
55-
$ kubectl run cockroachdb -it --image=cockroachdb/cockroach --rm --restart=Never \
56-
-- node decommission <node ID> --insecure --host=cockroachdb-public
65+
$ kubectl run cockroachdb -it \
66+
--image=cockroachdb/cockroach:{{page.release_info.version}} \
67+
--rm \
68+
--restart=Never \
69+
-- node decommission <node ID> \
70+
--insecure \
71+
--host=cockroachdb-public
5772
~~~
5873
</section>
5974
6075
<section class="filter-content" markdown="1" data-scope="helm">
6176
{% include copy-clipboard.html %}
6277
~~~ shell
63-
$ kubectl run cockroachdb -it --image=cockroachdb/cockroach --rm --restart=Never \
64-
-- node decommission <node ID> --insecure --host=my-release-cockroachdb-public
78+
$ kubectl run cockroachdb -it \
79+
--image=cockroachdb/cockroach:{{page.release_info.version}} \
80+
--rm \
81+
--restart=Never \
82+
-- node decommission <node ID> \
83+
--insecure \
84+
--host=my-release-cockroachdb-public
6585
~~~
6686
</section>
6787
@@ -85,7 +105,7 @@ If you remove nodes without first telling CockroachDB to decommission them, you
85105
No more data reported on target nodes. Please verify cluster health before removing the nodes.
86106
~~~
87107
88-
3. Once the node has been decommissioned, use the `kubectl scale` command to remove a pod from your StatefulSet:
108+
3. Once the node has been decommissioned, remove a pod from your StatefulSet:
89109
90110
<section class="filter-content" markdown="1" data-scope="manual">
91111
{% include copy-clipboard.html %}
@@ -101,10 +121,10 @@ If you remove nodes without first telling CockroachDB to decommission them, you
101121
<section class="filter-content" markdown="1" data-scope="helm">
102122
{% include copy-clipboard.html %}
103123
~~~ shell
104-
$ kubectl scale statefulset my-release-cockroachdb --replicas=3
105-
~~~
106-
107-
~~~
108-
statefulset "my-release-cockroachdb" scaled
124+
$ helm upgrade \
125+
my-release \
126+
stable/cockroachdb \
127+
--set Replicas=3 \
128+
--reuse-values
109129
~~~
110130
</section>

_includes/v19.1/orchestration/kubernetes-remove-nodes-secure.md

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
To safely remove a node from your cluster, you must first decommission the node and only then adjust the `--replicas` value of your StatefulSet configuration to permanently remove it. This sequence is important because the decommissioning process lets a node finish in-flight requests, rejects any new requests, and transfers all range replicas and range leases off the node.
1+
To safely remove a node from your cluster, you must first decommission the node and only then adjust the `Replicas` value of your StatefulSet configuration to permanently remove it. This sequence is important because the decommissioning process lets a node finish in-flight requests, rejects any new requests, and transfers all range replicas and range leases off the node.
22

33
{{site.data.alerts.callout_danger}}
44
If you remove nodes without first telling CockroachDB to decommission them, you may cause data or even cluster unavailability. For more details about how this works and what to consider before removing nodes, see [Decommission Nodes](remove-nodes.html).
@@ -9,33 +9,39 @@ If you remove nodes without first telling CockroachDB to decommission them, you
99
<section class="filter-content" markdown="1" data-scope="manual">
1010
{% include copy-clipboard.html %}
1111
~~~ shell
12-
$ kubectl exec -it cockroachdb-client-secure -- ./cockroach node status --certs-dir=/cockroach-certs --host=cockroachdb-public
12+
$ kubectl exec -it cockroachdb-client-secure \
13+
-- ./cockroach node status \
14+
--certs-dir=/cockroach-certs \
15+
--host=cockroachdb-public
1316
~~~
1417

1518
~~~
1619
id | address | build | started_at | updated_at | is_available | is_live
1720
+----+---------------------------------------------------------------------------------+--------+----------------------------------+----------------------------------+--------------+---------+
18-
1 | cockroachdb-0.cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:04:36.486082+00:00 | 2018-11-29 18:24:24.587454+00:00 | true | true
19-
2 | cockroachdb-2.cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:55:03.880406+00:00 | 2018-11-29 18:24:23.469302+00:00 | true | true
20-
3 | cockroachdb-1.cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:04:41.383588+00:00 | 2018-11-29 18:24:25.030175+00:00 | true | true
21-
4 | cockroachdb-3.cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 17:31:19.990784+00:00 | 2018-11-29 18:24:26.041686+00:00 | true | true
21+
1 | cockroachdb-0.cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:04:36.486082+00:00 | 2018-11-29 18:24:24.587454+00:00 | true | true
22+
2 | cockroachdb-2.cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:55:03.880406+00:00 | 2018-11-29 18:24:23.469302+00:00 | true | true
23+
3 | cockroachdb-1.cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:04:41.383588+00:00 | 2018-11-29 18:24:25.030175+00:00 | true | true
24+
4 | cockroachdb-3.cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 17:31:19.990784+00:00 | 2018-11-29 18:24:26.041686+00:00 | true | true
2225
(4 rows)
2326
~~~
2427
</section>
2528

2629
<section class="filter-content" markdown="1" data-scope="helm">
2730
{% include copy-clipboard.html %}
2831
~~~ shell
29-
$ kubectl exec -it cockroachdb-client-secure -- ./cockroach node status --certs-dir=/cockroach-certs --host=my-release-cockroachdb-public
32+
$ kubectl exec -it cockroachdb-client-secure \
33+
-- ./cockroach node status \
34+
--certs-dir=/cockroach-certs \
35+
--host=my-release-cockroachdb-public
3036
~~~
3137

3238
~~~
3339
id | address | build | started_at | updated_at | is_available | is_live
3440
+----+---------------------------------------------------------------------------------+--------+----------------------------------+----------------------------------+--------------+---------+
35-
1 | my-release-cockroachdb-0.my-release-cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:04:36.486082+00:00 | 2018-11-29 18:24:24.587454+00:00 | true | true
36-
2 | my-release-cockroachdb-2.my-release-cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:55:03.880406+00:00 | 2018-11-29 18:24:23.469302+00:00 | true | true
37-
3 | my-release-cockroachdb-1.my-release-cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 16:04:41.383588+00:00 | 2018-11-29 18:24:25.030175+00:00 | true | true
38-
4 | my-release-cockroachdb-3.my-release-cockroachdb.default.svc.cluster.local:26257 | v2.1.1 | 2018-11-29 17:31:19.990784+00:00 | 2018-11-29 18:24:26.041686+00:00 | true | true
41+
1 | my-release-cockroachdb-0.my-release-cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:04:36.486082+00:00 | 2018-11-29 18:24:24.587454+00:00 | true | true
42+
2 | my-release-cockroachdb-2.my-release-cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:55:03.880406+00:00 | 2018-11-29 18:24:23.469302+00:00 | true | true
43+
3 | my-release-cockroachdb-1.my-release-cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 16:04:41.383588+00:00 | 2018-11-29 18:24:25.030175+00:00 | true | true
44+
4 | my-release-cockroachdb-3.my-release-cockroachdb.default.svc.cluster.local:26257 | {{page.release_info.version}} | 2018-11-29 17:31:19.990784+00:00 | 2018-11-29 18:24:26.041686+00:00 | true | true
3945
(4 rows)
4046
~~~
4147
</section>
@@ -51,14 +57,20 @@ If you remove nodes without first telling CockroachDB to decommission them, you
5157
<section class="filter-content" markdown="1" data-scope="manual">
5258
{% include copy-clipboard.html %}
5359
~~~ shell
54-
$ kubectl exec -it cockroachdb-client-secure -- ./cockroach node decommission <node ID> --insecure --host=cockroachdb-public
60+
$ kubectl exec -it cockroachdb-client-secure \
61+
-- ./cockroach node decommission <node ID> \
62+
--insecure \
63+
--host=cockroachdb-public
5564
~~~
5665
</section>
5766

5867
<section class="filter-content" markdown="1" data-scope="helm">
5968
{% include copy-clipboard.html %}
6069
~~~ shell
61-
$ kubectl exec -it cockroachdb-client-secure -- ./cockroach node decommission <node ID> --insecure --host=my-release-cockroachdb-public
70+
$ kubectl exec -it cockroachdb-client-secure \
71+
-- ./cockroach node decommission <node ID> \
72+
--insecure \
73+
--host=my-release-cockroachdb-public
6274
~~~
6375
</section>
6476

@@ -98,10 +110,10 @@ If you remove nodes without first telling CockroachDB to decommission them, you
98110
<section class="filter-content" markdown="1" data-scope="helm">
99111
{% include copy-clipboard.html %}
100112
~~~ shell
101-
$ kubectl scale statefulset my-release-cockroachdb --replicas=3
102-
~~~
103-
104-
~~~
105-
statefulset "my-release-cockroachdb" scaled
113+
$ helm upgrade \
114+
my-release \
115+
stable/cockroachdb \
116+
--set Replicas=3 \
117+
--reuse-values
106118
~~~
107119
</section>

0 commit comments

Comments
 (0)