@@ -79,130 +79,138 @@ Pick a control plane node that you wish to upgrade first. It must have the `/etc
79
79
80
80
** For the first control plane node**
81
81
82
- - Upgrade kubeadm:
83
-
84
- {{< tabs name="k8s_install_kubeadm_first_cp" >}}
85
- {{% tab name="Ubuntu, Debian or HypriotOS" %}}
86
- # replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
87
- apt-mark unhold kubeadm && \
88
- apt-get update && apt-get install -y kubeadm={{< skew currentVersion >}}.x-00 && \
89
- apt-mark hold kubeadm
90
- {{% /tab %}}
91
- {{% tab name="CentOS, RHEL or Fedora" %}}
92
- # replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
93
- yum install -y kubeadm-{{< skew currentVersion >}}.x-0 --disableexcludes=kubernetes
94
- {{% /tab %}}
95
- {{< /tabs >}}
96
- <br />
97
-
98
- - Verify that the download works and has the expected version:
99
-
100
- ``` shell
101
- kubeadm version
102
- ```
103
-
104
- - Verify the upgrade plan:
105
-
106
- ` ` ` shell
107
- kubeadm upgrade plan
108
- ` ` `
109
-
110
- This command checks that your cluster can be upgraded, and fetches the versions you can upgrade to.
111
- It also shows a table with the component config version states.
112
-
113
- {{< note > }}
114
- ` kubeadm upgrade` also automatically renews the certificates that it manages on this node.
115
- To opt-out of certificate renewal the flag ` --certificate-renewal=false` can be used.
116
- For more information see the [certificate management guide](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs).
117
- {{< / note > }}
118
-
119
- {{< note > }}
120
- If ` kubeadm upgrade plan` shows any component configs that require manual upgrade, users must provide
121
- a config file with replacement configs to ` kubeadm upgrade apply` via the ` --config` command line flag.
122
- Failing to do so will cause ` kubeadm upgrade apply` to exit with an error and not perform an upgrade.
123
- {{< / note > }}
124
-
125
- - Choose a version to upgrade to, and run the appropriate command. For example:
126
-
127
- ` ` ` shell
128
- # replace x with the patch version you picked for this upgrade
129
- sudo kubeadm upgrade apply v{{< skew currentVersion > }}.x
130
- ` ` `
131
-
132
- Once the command finishes you should see:
133
-
134
- ```
135
- [upgrade/successful] SUCCESS! Your cluster was upgraded to " v{{< skew currentVersion >}}.x" . Enjoy!
136
-
137
- [upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven' t already done so.
138
- ```
139
-
140
- - Manually upgrade your CNI provider plugin.
141
-
142
- Your Container Network Interface (CNI) provider may have its own upgrade instructions to follow.
143
- Check the [addons](/docs/concepts/cluster-administration/addons/) page to
144
- find your CNI provider and see whether additional upgrade steps are required.
145
-
146
- This step is not required on additional control plane nodes if the CNI provider runs as a DaemonSet.
82
+ - Upgrade kubeadm:
83
+
84
+ {{< tabs name="k8s_install_kubeadm_first_cp" >}}
85
+ {{% tab name="Ubuntu, Debian or HypriotOS" %}}
86
+ ``` shell
87
+ # replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
88
+ apt-mark unhold kubeadm && \
89
+ apt-get update && apt-get install -y kubeadm={{< skew currentVersion > }}.x-00 && \
90
+ apt-mark hold kubeadm
91
+ ```
92
+ {{% /tab %}}
93
+ {{% tab name="CentOS, RHEL or Fedora" %}}
94
+ ``` shell
95
+ # replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
96
+ yum install -y kubeadm-{{< skew currentVersion > }}.x-0 --disableexcludes=kubernetes
97
+ ```
98
+ {{% /tab %}}
99
+ {{< /tabs >}}
100
+ <br />
101
+
102
+ - Verify that the download works and has the expected version:
103
+
104
+ ``` shell
105
+ kubeadm version
106
+ ```
107
+
108
+ - Verify the upgrade plan:
109
+
110
+ ``` shell
111
+ kubeadm upgrade plan
112
+ ```
113
+
114
+ This command checks that your cluster can be upgraded, and fetches the versions you can upgrade to.
115
+ It also shows a table with the component config version states.
116
+
117
+ {{< note >}}
118
+ ` kubeadm upgrade ` also automatically renews the certificates that it manages on this node.
119
+ To opt-out of certificate renewal the flag ` --certificate-renewal=false ` can be used.
120
+ For more information see the [ certificate management guide] ( /docs/tasks/administer-cluster/kubeadm/kubeadm-certs ) .
121
+ {{</ note >}}
122
+
123
+ {{< note >}}
124
+ If ` kubeadm upgrade plan ` shows any component configs that require manual upgrade, users must provide
125
+ a config file with replacement configs to ` kubeadm upgrade apply ` via the ` --config ` command line flag.
126
+ Failing to do so will cause ` kubeadm upgrade apply ` to exit with an error and not perform an upgrade.
127
+ {{</ note >}}
128
+
129
+ - Choose a version to upgrade to, and run the appropriate command. For example:
130
+
131
+ ``` shell
132
+ # replace x with the patch version you picked for this upgrade
133
+ sudo kubeadm upgrade apply v{{< skew currentVersion > }}.x
134
+ ```
135
+
136
+ Once the command finishes you should see:
137
+
138
+ ```
139
+ [upgrade/successful] SUCCESS! Your cluster was upgraded to "v{{< skew currentVersion >}}.x". Enjoy!
140
+
141
+ [upgrade/kubelet] Now that your control plane is upgraded, please proceed with upgrading your kubelets if you haven't already done so.
142
+ ```
143
+
144
+ - Manually upgrade your CNI provider plugin.
145
+
146
+ Your Container Network Interface (CNI) provider may have its own upgrade instructions to follow.
147
+ Check the [ addons] ( /docs/concepts/cluster-administration/addons/ ) page to
148
+ find your CNI provider and see whether additional upgrade steps are required.
149
+
150
+ This step is not required on additional control plane nodes if the CNI provider runs as a DaemonSet.
147
151
148
152
** For the other control plane nodes**
149
153
150
154
Same as the first control plane node but use:
151
155
152
- ```
156
+ ``` shell
153
157
sudo kubeadm upgrade node
154
158
```
155
159
156
160
instead of:
157
161
158
- ```
162
+ ``` shell
159
163
sudo kubeadm upgrade apply
160
164
```
161
165
162
166
Also calling ` kubeadm upgrade plan ` and upgrading the CNI provider plugin is no longer needed.
163
167
164
168
### Drain the node
165
169
166
- - Prepare the node for maintenance by marking it unschedulable and evicting the workloads:
170
+ - Prepare the node for maintenance by marking it unschedulable and evicting the workloads:
167
171
168
- ```shell
169
- # replace <node-to-drain> with the name of your node you are draining
170
- kubectl drain <node-to-drain> --ignore-daemonsets
171
- ```
172
+ ``` shell
173
+ # replace <node-to-drain> with the name of your node you are draining
174
+ kubectl drain < node-to-drain> --ignore-daemonsets
175
+ ```
172
176
173
177
### Upgrade kubelet and kubectl
174
178
175
- - Upgrade the kubelet and kubectl:
176
-
177
- {{< tabs name="k8s_install_kubelet" >}}
178
- {{% tab name="Ubuntu, Debian or HypriotOS" %}}
179
- # replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
180
- apt-mark unhold kubelet kubectl && \
181
- apt-get update && apt-get install -y kubelet={{< skew currentVersion >}}.x-00 kubectl={{< skew currentVersion >}}.x-00 && \
182
- apt-mark hold kubelet kubectl
183
- {{% /tab %}}
184
- {{% tab name="CentOS, RHEL or Fedora" %}}
185
- # replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
186
- yum install -y kubelet-{{< skew currentVersion >}}.x-0 kubectl-{{< skew currentVersion >}}.x-0 --disableexcludes=kubernetes
187
- {{% /tab %}}
188
- {{< /tabs >}}
189
- <br />
190
-
191
- - Restart the kubelet:
192
-
193
- ```shell
194
- sudo systemctl daemon-reload
195
- sudo systemctl restart kubelet
196
- ```
179
+ - Upgrade the kubelet and kubectl:
180
+
181
+ {{< tabs name="k8s_install_kubelet" >}}
182
+ {{% tab name="Ubuntu, Debian or HypriotOS" %}}
183
+ ``` shell
184
+ # replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
185
+ apt-mark unhold kubelet kubectl && \
186
+ apt-get update && apt-get install -y kubelet={{< skew currentVersion > }}.x-00 kubectl={{< skew currentVersion > }}.x-00 && \
187
+ apt-mark hold kubelet kubectl
188
+ ```
189
+ {{% /tab %}}
190
+ {{% tab name="CentOS, RHEL or Fedora" %}}
191
+ ``` shell
192
+ # replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
193
+ yum install -y kubelet-{{< skew currentVersion > }}.x-0 kubectl-{{< skew currentVersion > }}.x-0 --disableexcludes=kubernetes
194
+ ```
195
+ {{% /tab %}}
196
+ {{< /tabs >}}
197
+ <br />
198
+
199
+ - Restart the kubelet:
200
+
201
+ ``` shell
202
+ sudo systemctl daemon-reload
203
+ sudo systemctl restart kubelet
204
+ ```
197
205
198
206
### Uncordon the node
199
207
200
- - Bring the node back online by marking it schedulable:
208
+ - Bring the node back online by marking it schedulable:
201
209
202
- ```shell
203
- # replace <node-to-drain> with the name of your node
204
- kubectl uncordon <node-to-drain>
205
- ```
210
+ ``` shell
211
+ # replace <node-to-drain> with the name of your node
212
+ kubectl uncordon < node-to-drain>
213
+ ```
206
214
207
215
## Upgrade worker nodes
208
216
@@ -211,76 +219,83 @@ without compromising the minimum required capacity for running your workloads.
211
219
212
220
### Upgrade kubeadm
213
221
214
- - Upgrade kubeadm:
215
-
216
- {{< tabs name="k8s_install_kubeadm_worker_nodes" >}}
217
- {{% tab name="Ubuntu, Debian or HypriotOS" %}}
218
- # replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
219
- apt-mark unhold kubeadm && \
220
- apt-get update && apt-get install -y kubeadm={{< skew currentVersion >}}.x-00 && \
221
- apt-mark hold kubeadm
222
- {{% /tab %}}
223
- {{% tab name="CentOS, RHEL or Fedora" %}}
224
- # replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
225
- yum install -y kubeadm-{{< skew currentVersion >}}.x-0 --disableexcludes=kubernetes
226
- {{% /tab %}}
227
- {{< /tabs >}}
222
+ - Upgrade kubeadm:
223
+
224
+ {{< tabs name="k8s_install_kubeadm_worker_nodes" >}}
225
+ {{% tab name="Ubuntu, Debian or HypriotOS" %}}
226
+ ``` shell
227
+ # replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
228
+ apt-mark unhold kubeadm && \
229
+ apt-get update && apt-get install -y kubeadm={{< skew currentVersion > }}.x-00 && \
230
+ apt-mark hold kubeadm
231
+ ```
232
+ {{% /tab %}}
233
+ {{% tab name="CentOS, RHEL or Fedora" %}}
234
+ ``` shell
235
+ # replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
236
+ yum install -y kubeadm-{{< skew currentVersion > }}.x-0 --disableexcludes=kubernetes
237
+ ```
238
+ {{% /tab %}}
239
+ {{< /tabs >}}
228
240
229
241
### Call "kubeadm upgrade"
230
242
231
- - For worker nodes this upgrades the local kubelet configuration:
243
+ - For worker nodes this upgrades the local kubelet configuration:
232
244
233
- ```shell
234
- sudo kubeadm upgrade node
235
- ```
245
+ ``` shell
246
+ sudo kubeadm upgrade node
247
+ ```
236
248
237
249
### Drain the node
238
250
239
- - Prepare the node for maintenance by marking it unschedulable and evicting the workloads:
251
+ - Prepare the node for maintenance by marking it unschedulable and evicting the workloads:
240
252
241
- ```shell
242
- # replace <node-to-drain> with the name of your node you are draining
243
- kubectl drain <node-to-drain> --ignore-daemonsets
244
- ```
253
+ ``` shell
254
+ # replace <node-to-drain> with the name of your node you are draining
255
+ kubectl drain < node-to-drain> --ignore-daemonsets
256
+ ```
245
257
246
258
### Upgrade kubelet and kubectl
247
259
248
- - Upgrade the kubelet and kubectl:
249
-
250
- {{< tabs name="k8s_kubelet_and_kubectl" >}}
251
- {{% tab name="Ubuntu, Debian or HypriotOS" %}}
252
- # replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
253
- apt-mark unhold kubelet kubectl && \
254
- apt-get update && apt-get install -y kubelet={{< skew currentVersion >}}.x-00 kubectl={{< skew currentVersion >}}.x-00 && \
255
- apt-mark hold kubelet kubectl
256
- {{% /tab %}}
257
- {{% tab name="CentOS, RHEL or Fedora" %}}
258
- # replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
259
- yum install -y kubelet-{{< skew currentVersion >}}.x-0 kubectl-{{< skew currentVersion >}}.x-0 --disableexcludes=kubernetes
260
- {{% /tab %}}
261
- {{< /tabs >}}
262
- <br />
263
-
264
- - Restart the kubelet:
265
-
266
- ```shell
267
- sudo systemctl daemon-reload
268
- sudo systemctl restart kubelet
269
- ```
260
+ - Upgrade the kubelet and kubectl:
261
+
262
+ {{< tabs name="k8s_kubelet_and_kubectl" >}}
263
+ {{% tab name="Ubuntu, Debian or HypriotOS" %}}
264
+ ``` shell
265
+ # replace x in {{< skew currentVersion >}}.x-00 with the latest patch version
266
+ apt-mark unhold kubelet kubectl && \
267
+ apt-get update && apt-get install -y kubelet={{< skew currentVersion > }}.x-00 kubectl={{< skew currentVersion > }}.x-00 && \
268
+ apt-mark hold kubelet kubectl
269
+ {{% /tab %}}
270
+ {{% tab name=" CentOS, RHEL or Fedora" %}}
271
+ ` ` ` shell
272
+ # replace x in {{< skew currentVersion >}}.x-0 with the latest patch version
273
+ yum install -y kubelet-{{< skew currentVersion > }}.x-0 kubectl-{{< skew currentVersion > }}.x-0 --disableexcludes=kubernetes
274
+ ` ` `
275
+ {{% /tab %}}
276
+ {{< /tabs > }}
277
+ < br />
278
+
279
+ - Restart the kubelet:
280
+
281
+ ` ` ` shell
282
+ sudo systemctl daemon-reload
283
+ sudo systemctl restart kubelet
284
+ ` ` `
270
285
271
286
# ## Uncordon the node
272
287
273
- - Bring the node back online by marking it schedulable:
288
+ - Bring the node back online by marking it schedulable:
274
289
275
- ```shell
276
- # replace <node-to-drain> with the name of your node
277
- kubectl uncordon <node-to-drain>
278
- ```
290
+ ` ` ` shell
291
+ # replace <node-to-drain> with the name of your node
292
+ kubectl uncordon < node-to-drain>
293
+ ` ` `
279
294
280
295
# # Verify the status of the cluster
281
296
282
- After the kubelet is upgraded on all nodes verify that all nodes are available again by running the following command
283
- from anywhere kubectl can access the cluster:
297
+ After the kubelet is upgraded on all nodes verify that all nodes are available again by running
298
+ the following command from anywhere kubectl can access the cluster:
284
299
285
300
` ` ` shell
286
301
kubectl get nodes
@@ -296,6 +311,7 @@ This command is idempotent and eventually makes sure that the actual state is th
296
311
To recover from a bad state, you can also run ` kubeadm upgrade apply --force` without changing the version that your cluster is running.
297
312
298
313
During upgrade kubeadm writes the following backup folders under ` /etc/kubernetes/tmp` :
314
+
299
315
- ` kubeadm-backup-etcd-< date> -< time> `
300
316
- ` kubeadm-backup-manifests-< date> -< time> `
301
317
@@ -334,3 +350,4 @@ and post-upgrade manifest file for a certain component, a backup file for it wil
334
350
335
351
- Fetches the kubeadm `ClusterConfiguration` from the cluster.
336
352
- Upgrades the kubelet configuration for this node.
353
+
0 commit comments