8000 add helm upgrade section for no downtime (#4272) · nginx/kubernetes-ingress@79a3eb9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 79a3eb9

Browse files
authored
add helm upgrade section for no downtime (#4272)
1 parent 6a3ef3f commit 79a3eb9

File tree

1 file changed

+120
-13
lines changed

1 file changed

+120
-13
lines changed

docs/content/installation/installation-with-helm.md

Lines changed: 120 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ If you do not use the custom resources that require those CRDs (which correspond
3535

3636
To upgrade the CRDs, pull the chart sources as described in [Pulling the Chart](#pulling-the-chart) and then run:
3737

38-
```console
38+
```shell
3939
kubectl apply -f crds/
4040
```
4141

@@ -49,7 +49,7 @@ kubectl apply -f crds/
4949

5050
To remove the CRDs, pull the chart sources as described in [Pulling the Chart](#pulling-the-chart) and then run:
5151

52-
```console
52+
```shell
5353
kubectl delete -f crds/
5454
```
5555

@@ -65,13 +65,13 @@ To install the chart with the release name my-release (my-release is the name th
6565

6666
For NGINX:
6767

68-
```console
68+
```shell
6969
helm install my-release oci://ghcr.io/nginxinc/charts/nginx-ingress --version 0.18.1
7070
```
7171

7272
For NGINX Plus: (assuming you have pushed the Ingress Controller image `nginx-plus-ingress` to your private registry `myregistry.example.com`)
7373

74-
```console
74+
```shell
7575
helm install my-release oci://ghcr.io/nginxinc/charts/nginx-ingress --version 0.18.1 --set controller.image.repository=myregistry.example.com/nginx-plus-ingress --set controller.nginxplus=true
7676
```
7777

@@ -83,15 +83,15 @@ Helm does not upgrade the CRDs during a release upgrade. Before you upgrade a re
8383

8484
To upgrade the release `my-release`:
8585

86-
```console
86+
```shell
8787
helm upgrade my-release oci://ghcr.io/nginxinc/charts/nginx-ingress --version 0.18.1
8888
```
8989

9090
### Uninstalling the Chart
9191

9292
To uninstall/delete the release `my-release`:
9393

94-
```console
94+
```shell
9595
helm uninstall my-release
9696
```
9797

@@ -104,7 +104,7 @@ Uninstalling the release does not remove the CRDs. To remove the CRDs, see [Unin
104104
To test the latest changes in NGINX Ingress Controller before a new release, you can install the `edge` version. This version is built from the `main` branch of the NGINX Ingress Controller repository.
105105
You can install the `edge` version by specifying the `--version` flag with the value `0.0.0-edge`:
106106

107-
```console
107+
```shell
108108
helm install my-release oci://ghcr.io/nginxinc/charts/nginx-ingress --version 0.0.0-edge
109109
```
110110

@@ -120,13 +120,13 @@ This step is required if you're installing the chart using its sources. Addition
120120

121121
1. Pull the chart sources:
122122

123-
```console
123+
```shell
124124
helm pull oci://ghcr.io/nginxinc/charts/nginx-ingress --untar --version 0.18.1
125125
```
126126

127127
2. Change your working directory to nginx-ingress:
128128

129-
```console
129+
```shell
130130
cd nginx-ingress
131131
```
132132

@@ -136,13 +136,13 @@ To install the chart with the release name my-release (my-release is the name th
136136

137137
For NGINX:
138138

139-
```console
139+
```shell
140140
helm install my-release .
141141
```
142142

143143
For NGINX Plus:
144144

145-
```console
145+
```shell
146146
helm install my-release -f values-plus.yaml .
147147
```
148148

@@ -154,22 +154,129 @@ Helm does not upgrade the CRDs during a release upgrade. Before you upgrade a re
154154

155155
To upgrade the release `my-release`:
156156

157-
```console
157+
```shell
158158
helm upgrade my-release .
159159
```
160160

161161
### Uninstalling the Chart
162162

163163
To uninstall/delete the release `my-release`:
164164

165-
```console
165+
```shell
166166
helm uninstall my-release
167167
```
168168

169169
The command removes all the Kubernetes components associated with the release and deletes the release.
170170

171171
Uninstalling the release does not remove the CRDs. To remove the CRDs, see [Uninstalling the CRDs](#uninstalling-the-crds).
172172

173+
174+
## Upgrading without downtime
175+
176+
### Background
177+
178+
In NGINX Ingress Controller version 3.1.0, [changes were introduced](https://github.com/nginxinc/kubernetes-ingress/pull/3606) to Helm resource names, labels and annotations to fit with Helm best practices.
179+
When using Helm to upgrade from a version prior to 3.1.0, certain resources like Deployment, DaemonSet and Service will be recreated due to the aforementioned changes, which will result in downtime.
180+
181+
Although the advisory is to update all resources in accordance with new naming convention, to avoid the downtime please follow the steps listed in this page.
182+
183+
### Upgrade Steps
184+
{{<note>}} The following steps apply to both 2.x and 3.0.x releases.{{</note>}}
185+
186+
The steps you should follow depend on the Helm release name:
187+
188+
{{<tabs name="upgrade-helm">}}
189+
190+
{{%tab name="Helm release name is `nginx-ingress`"%}}
191+
192+
1. Use `kubectl describe` on deployment/daemonset to get the `Selector` value:
193+
194+
```shell
195+
kubectl describe deployments -n <namespace>
196+
```
197+
Copy the key=value under `Selector`, such as:
198+
199+
```shell
200+
Selector: app=nginx-ingress-nginx-ingress
201+
```
202+
203+
2. Checkout the latest available tag using `git checkout v3.3.0`
204+
205+
3. Navigate to `/kubernates-ingress/deployments/helm-chart`
206+
207+
4. Update the `selectorLabels: {}` field in the `values.yaml` file located at `/kubernates-ingress/deployments/helm-chart` with the copied `Selector` value.
208+
```shell
209+
selectorLabels: {app: nginx-ingress-nginx-ingress}
210+
```
211+
212+
5. Run `helm upgrade` with following arguments set:
213+
```shell
214+
--set controller.serviceNameOverride="nginx-ingress-nginx-ingress"
215+
--set controller.name=""
216+
--set fullnameOverride="nginx-ingress-nginx-ingress"
217+
```
218+
It could look as follows:
219+
220+
```shell
221+
helm upgrade nginx-ingress oci://ghcr.io/nginxinc/charts/nginx-ingress --version 0.19.0 --set controller.kind=deployment/daemonset --set controller.nginxplus=false/true --set controller.image.pullPolicy=Always --set controller.serviceNameOverride="nginx-ingress-nginx-ingress" --set controller.name="" --set fullnameOverride="nginx-ingress-nginx-ingress" -f values.yaml
222+
```
223+
224+
6. Once the upgrade process has finished, use `kubectl describe` on the deployment to verify the change by reviewing its events:
225+
```shell
226+
Type Reason Age From Message
227+
---- ------ ---- ---- -------
228+
Normal ScalingReplicaSet 9m11s deployment-controller Scaled up replica set nginx-ingress-nginx-ingress-<old_version> to 1
229+
Normal ScalingReplicaSet 101s deployment-controller Scaled up replica set nginx-ingress-nginx-ingress-<new_version> to 1
230+
Normal ScalingReplicaSet 98s deployment-controller Scaled down replica set nginx-ingress-nginx-ingress-<old_version> to 0 from 1
231+
```
232+
{{%/tab%}}
233+
234+
{{%tab name="Helm release name is not `nginx-ingress`"%}}
235+
236+
1. Use `kubectl describe` on deployment/daemonset to get the `Selector` value:
237+
238+
```shell
239+
kubectl describe deployment/daemonset -n <namespace>
240+
```
241+
Copy the key=value under ```Selector```, such as:
242+
243+
```shell
244+
Selector: app=<helm_release_name>-nginx-ingress
245+
```
246+
247+
2. Checkout the latest available tag using `git checkout v3.3.0`
248+
249+
3. Navigate to `/kubernates-ingress/deployments/helm-chart`
250+
251+
4. Update the `selectorLabels: {}` field in the `values.yaml` file located at `/kubernates-ingress/deployments/helm-chart` with the copied `Selector` value.
252+
```shell
253+
selectorLabels: {app: <helm_release_name>-nginx-ingress}
254+
```
255+
256+
5. Run `helm upgrade` with following arguments set:
257+
```shell
258+
--set controller.serviceNameOverride="<helm_release_name>-nginx-ingress"
259+
--set controller.name=""
260+
```
261+
It could look as follows:
262+
263+
```shell
264+
helm upgrade test-release oci://ghcr.io/nginxinc/charts/nginx-ingress --version 0.19.0 --set controller.kind=deployment/daemonset --set controller.nginxplus=false/true --set controller.image.pullPolicy=Always --set controller.serviceNameOverride="test-release-nginx-ingress" --set controller.name="" -f values.yaml
265+
```
266+
267+
6. Once the upgrade process has finished, use `kubectl describe` on the deployment to verify the change by reviewing its events:
268+
```shell
269+
Type Reason Age From Message
270+
---- ------ ---- ---- -------
271+
Normal ScalingReplicaSet 9m11s deployment-controller Scaled up replica set test-release-nginx-ingress-<old_version> to 1
272+
Normal ScalingReplicaSet 101s deployment-controller Scaled up replica set test-release-nginx-ingress-<new_version> to 1
273+
Normal ScalingReplicaSet 98s deployment-controller Scaled down replica set test-release-nginx-ingress-<old_version> to 0 from 1
274+
```
275+
{{%/tab%}}
276+
277+
{{</tabs>}}
278+
279+
173280
## Running Multiple Ingress Controllers
174281

175282
If you are running multiple Ingress Controller releases in your cluster with enabled custom resources, the releases will share a single version of the CRDs. As a result, make sure that the Ingress Controller versions match the version of the CRDs. Additionally, when uninstalling a release, ensure that you don’t remove the CRDs until there are no other Ingress Controller releases running in the cluster.

0 commit comments

Comments
 (0)
0