|
| 1 | +--- |
| 2 | +layout: two-cols |
| 3 | +transition: fade |
| 4 | +title: Ingresses |
| 5 | +--- |
| 6 | + |
| 7 | +# [Ingresses](https://kubernetes.io/docs/concepts/services-networking/ingress/) |
| 8 | + |
| 9 | +They allow the exposure of multiple HTTP services through the same endpoint, acting as a reverse proxy |
| 10 | + |
| 11 | +<v-clicks at="7"> |
| 12 | + |
| 13 | +`Ingresses` also rely on the <Link to="operator-pattern">operator pattern</Link>, but no default controller is provided out of the box |
| 14 | + |
| 15 | +<small>N.B. `Ingresses` are now in the EoL, superseded by [Gateway API](https://kubernetes.io/docs/concepts/services-networking/gateway/). However, they are still widely used</small> |
| 16 | + |
| 17 | +</v-clicks> |
| 18 | + |
| 19 | +::right:: |
| 20 | + |
| 21 | +<<<@/snippets/manifests/ingresses/ingress-echo-server.yaml yaml[ingress-echo-server.yaml]{hide|all|1-2|7|10-11|12-16|all}{lines:true,at:1} |
| 22 | + |
| 23 | +<!-- |
| 24 | +[click:2] `apiVersion` and `kind` |
| 25 | +
|
| 26 | +[click] `host` |
| 27 | +
|
| 28 | +[click] `path` and `pathType: Prefix` |
| 29 | + - `Prefix` matches based on a URL path prefix, |
| 30 | + - `Exact` matches the URL path exactly |
| 31 | +
|
| 32 | +[click] `backend`, `port` can be provided as `name` or `number` |
| 33 | +--> |
| 34 | + |
| 35 | +--- |
| 36 | +layout: two-cols-header |
| 37 | +transition: fade |
| 38 | +hideInToc: true |
| 39 | +--- |
| 40 | + |
| 41 | +# [Ingresses](https://kubernetes.io/docs/concepts/services-networking/ingress/) |
| 42 | + |
| 43 | +To use `Ingresses`, a specific controller has to provision it |
| 44 | + |
| 45 | +::left:: |
| 46 | + |
| 47 | +<v-clicks> |
| 48 | + |
| 49 | +There are various controllers based on applications like `nginx`, `traefik`, etc. |
| 50 | + |
| 51 | +One of the most popular is the [Ingress-Nginx Controller](https://kubernetes.github.io/ingress-nginx/) |
| 52 | + |
| 53 | +It can be easily installed exploiting the official [helm chart](https://kubernetes.github.io/ingress-nginx/deploy/#quick-start) |
| 54 | + |
| 55 | +</v-clicks> |
| 56 | + |
| 57 | +::right:: |
| 58 | + |
| 59 | +```shell{hide|all} |
| 60 | +helm repo add ingress-nginx \ |
| 61 | + https://kubernetes.github.io/ingress-nginx |
| 62 | +``` |
| 63 | + |
| 64 | +<div class="mt-5" /> |
| 65 | + |
| 66 | +<<<@/snippets/manifests/ingresses/ingress-nginx-values.yaml yaml[values.yaml]{hide|all}{lines:true} |
| 67 | + |
| 68 | +<div class="mt-5" /> |
| 69 | + |
| 70 | +```shell{hide|all} |
| 71 | +helm install -n ingress-nginx --create-namespace \ |
| 72 | + --values ./values.yaml \ |
| 73 | + ingress-nginx ingress-nginx/ingress-nginx |
| 74 | +``` |
| 75 | + |
| 76 | +--- |
| 77 | +layout: two-cols |
| 78 | +transition: fade |
| 79 | +hideInToc: true |
| 80 | +--- |
| 81 | + |
| 82 | +# [Ingresses](https://kubernetes.io/docs/concepts/services-networking/ingress/) |
| 83 | + |
| 84 | +Ingress can be now provisioned by the nginx controller |
| 85 | + |
| 86 | +<v-clicks> |
| 87 | + |
| 88 | +When the controller receives an HTTP request matching the `Host` header and the path prefix, it will be redirected to the backend service |
| 89 | + |
| 90 | +</v-clicks> |
| 91 | + |
| 92 | +::right:: |
| 93 | + |
| 94 | +````md magic-move[ingress-echo-server.yaml]{lines:true} |
| 95 | +<<<@/snippets/manifests/ingresses/ingress-echo-server.yaml yaml |
| 96 | +```` |
| 97 | + |
| 98 | +<!-- |
| 99 | +```shell |
| 100 | +kubectl apply -f ./snippets/manifests/ingresses/ingress-echo-server.yaml |
| 101 | +curl -H "Host: echo.example.org" http://{node_ip}:30080 |
| 102 | +``` |
| 103 | +--> |
| 104 | + |
| 105 | +--- |
| 106 | +layout: two-cols |
| 107 | +transition: fade |
| 108 | +hideInToc: true |
| 109 | +--- |
| 110 | + |
| 111 | +# [IngressClasses](https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-class) |
| 112 | + |
| 113 | +They allow specifying which controller should provision an `Ingress` |
| 114 | + |
| 115 | +<<< @/snippets/manifests/ingresses/ingress-nginx-class.yaml yaml{hide|all}{lines:true} |
| 116 | + |
| 117 | +::right:: |
| 118 | + |
| 119 | +````md magic-move[ingress-echo-server.yaml]{lines:true} |
| 120 | +<<< @/snippets/manifests/ingresses/ingress-echo-server.yaml yaml{all} |
| 121 | + |
| 122 | +<<< @/snippets/manifests/ingresses/ingress-echo-server-class.yaml yaml{6} |
| 123 | +```` |
0 commit comments