|
4 | 4 |
|
5 | 5 | - [Istio nftables backend](#istio-nftables-backend) |
6 | 6 | - [Prerequisites](#prerequisites) |
7 | | - - [Installation steps](#installation-steps) |
8 | | - - [Installation on OpenShift](#installation-on-openshift) |
| 7 | + - [Installation](#installation) |
| 8 | + - [Install with Sail Operator on OpenShift](#install-with-sail-operator-on-openshift) |
| 9 | + - [Install in Ambient Mode](#install-in-ambient-mode) |
9 | 10 | - [Validation](#validation) |
| 11 | + - [Upgrade](#upgrade) |
| 12 | + - [Upgrade with Sail Operator on OpenShift](#upgrade-with-sail-operator-on-openshift) |
| 13 | + - [Upgrade in Ambient Mode](#upgrade-in-ambient-mode) |
10 | 14 |
|
11 | | -## Istio nftables backend |
12 | 15 |
|
13 | | -This document outlines the configuration steps for the nftables backend in Istio. As the official successor to iptables, nftables offers a modern, high-performance alternative for transparently redirecting traffic to and from the Envoy sidecar proxy. Many major Linux distributions are actively moving towards adopting native nftables support. At present, this backend supports Istio sidecar mode only, with ambient mode support currently under development. |
| 16 | +## Istio nftables backend |
14 | 17 |
|
| 18 | +This document outlines the configuration steps for the nftables backend in Istio. As the official successor to iptables, nftables offers a modern, high-performance alternative for transparently redirecting traffic to and from the Envoy sidecar proxy. Many major Linux distributions are actively moving towards adopting native nftables support. |
15 | 19 | ### Prerequisites |
16 | 20 |
|
17 | 21 | - **nftables version**: Requires `nft` binary version 1.0.1 or later. |
18 | 22 |
|
19 | | -### Installation Steps |
| 23 | +### Installation |
| 24 | + |
| 25 | +The support for native nftables when using Istio sidecar mode was implemented in the upstream istio release-1.27 [release note](https://github.com/istio/istio/blob/master/releasenotes/notes/nftables-sidecar.yaml). It is disabled by default. To enable it, you can set a feature flag as `values.global.nativeNftables=true`. For example, |
| 26 | + |
| 27 | +Installation with Istioctl |
20 | 28 |
|
21 | | -The support for native nftables when using Istio sidecar mode was implemented in the upstream istio release-1.27 [release note](https://github.com/istio/istio/blob/master/releasenotes/notes/nftables-sidecar.yaml). It is disabled by default. To enable it, you can create an instance of the `Istio` resource with `spec.values.global.nativeNftables=true`: |
| 29 | +```sh |
| 30 | +istioctl install --set values.global.nativeNftables=true -y |
| 31 | +``` |
| 32 | + |
| 33 | +Installation with Helm |
| 34 | + |
| 35 | +```sh |
| 36 | +helm install istiod-canary istio/istiod \ |
| 37 | + --set values.global.nativeNftables=true \ |
| 38 | + -n istio-system |
| 39 | +``` |
| 40 | + |
| 41 | +#### Install with Sail Operator on OpenShift |
| 42 | + |
| 43 | +When you install an Istio resource with Sail Operator, you can create an instance of the `Istio` resource with `spec.values.global.nativeNftables=true`. |
22 | 44 |
|
23 | 45 | ```sh |
24 | 46 | apiVersion: sailoperator.io/v1 |
|
38 | 60 |
|
39 | 61 | This feature configures Istio to use the `nftables` backend instead of `iptables` for traffic redirection. |
40 | 62 |
|
41 | | -#### Installation on OpenShift |
42 | | - |
43 | 63 | To enable the Istio native nftables feature, using the following steps: |
44 | 64 |
|
45 | 65 | 1. Create the `Subscription` object with a 1.27 channel. |
@@ -109,6 +129,8 @@ spec: |
109 | 129 | nativeNftables: true |
110 | 130 | ``` |
111 | 131 |
|
| 132 | +#### Install in Ambient Mode |
| 133 | + |
112 | 134 | ### Validation |
113 | 135 |
|
114 | 136 | When using the `nftables` backend, you can verify the traffic redirection rules using the `nft list ruleset` command in the `istio-proxy` container. The following example installs a sample application `curl` in a data plane namespace `test-ns`. |
@@ -168,3 +190,78 @@ table inet istio-proxy-nat { |
168 | 190 | ``` |
169 | 191 |
|
170 | 192 | More guidelines: [Debugging Guidelines](https://github.com/istio/istio/tree/master/tools/istio-nftables/pkg#debugging-guidelines) |
| 193 | + |
| 194 | +### Upgrade |
| 195 | + |
| 196 | +The migration of using the existing Istio iptables backend to nftables backend can be done by upgrading Istio. The following example installs an Istio control plane with the iptables backend and a sample application curl in a data plane namespace test-ns. |
| 197 | + |
| 198 | +```sh |
| 199 | +istioctl install -y |
| 200 | + |
| 201 | +kubectl create ns test-ns |
| 202 | +kubectl label namespace test-ns istio-injection=enabled |
| 203 | +kubectl apply -n test-ns -f samples/curl/curl.yaml |
| 204 | +``` |
| 205 | + |
| 206 | +You may create another Istio control plane with a revision value and gradually migrate data plane traffic to the new revision Istio control plane. This canary upgrade approach is much safer than doing an in-place upgrade. For example, |
| 207 | + |
| 208 | +1. Install a canary version of Istio with the nftables backend. |
| 209 | + |
| 210 | +```sh |
| 211 | +istioctl install --set revision=canary --set values.global.nativeNftables=true -y |
| 212 | +``` |
| 213 | + |
| 214 | +2. Upgrade the data plane and restart the deployment |
| 215 | + |
| 216 | +```sh |
| 217 | +kubectl label namespace test-ns istio-injection- istio.io/rev=canary |
| 218 | +kubectl rollout restart deployment -n test-ns |
| 219 | +``` |
| 220 | + |
| 221 | +3. Check the nftables backend running in the curl application pod. When using the nftables backend, You get the table inet rules in the istio-proxy container. For example, attach a debug container and run nft list ruleset command: |
| 222 | + |
| 223 | +```sh |
| 224 | +kubectl -n test-ns debug --image istio/base --profile netadmin --attach -t -i \ |
| 225 | + "$(kubectl -n test-ns get pod -l app=curl -o jsonpath='{.items..metadata.name}')" |
| 226 | + |
| 227 | +root@curl-6c88b89ddf-kbzn6:$ nft list ruleset |
| 228 | +``` |
| 229 | + |
| 230 | +4. Verify the connectivity between two pods is working. For example, deploy a httpbin application using the following step: |
| 231 | + |
| 232 | +```sh |
| 233 | +kubectl apply -n test-ns -f samples/httpbin/httpbin.yaml |
| 234 | +kubectl exec -n test-ns "$(kubectl get pod -l app=curl -n test-ns -o jsonpath={.items..metadata.name})" -c curl -n test-ns -- curl http://httpbin.test-ns:8000/ip -s -o /dev/null -w "%{http_code}\n" |
| 235 | + |
| 236 | +200 |
| 237 | +``` |
| 238 | + |
| 239 | +5. After upgrading both the control plane and data plane, you can uninstall the old control plane in this example. |
| 240 | + |
| 241 | +```sh |
| 242 | +istioctl uninstall --revision default -y |
| 243 | +``` |
| 244 | + |
| 245 | +When upgrading Istio with the CNI node agent, you can install a canary version of Istio control plane and upgrade the istio-cni node agent separately. For example, there is an Istio CNI component running in the istio-cni namespace, you can upgrade and enable the nftables backend using the following steps: |
| 246 | + |
| 247 | +1. Install a canary version of Istiod control plane with the nftables backend. |
| 248 | + |
| 249 | +```sh |
| 250 | +helm install istiod-canary istio/istiod \ |
| 251 | + --set revision=canary \ |
| 252 | + --set values.global.nativeNftables=true \ |
| 253 | + -n istio-system |
| 254 | +``` |
| 255 | + |
| 256 | +2. Upgrade the CNI component separately from the revisioned control plane. |
| 257 | + |
| 258 | +```sh |
| 259 | +helm upgrade istio-cni istio/cni \ |
| 260 | + --set values.global.nativeNftables=true \ |
| 261 | + -n istio-cni --wait |
| 262 | +``` |
| 263 | + |
| 264 | +#### Upgrade with Sail Operator on OpenShift |
| 265 | + |
| 266 | +#### Upgrade in Ambient mode |
| 267 | + |
0 commit comments