From 43cc2b7e192cb1fbfc01b115f795f187510420c7 Mon Sep 17 00:00:00 2001 From: Matteo <matteo.difazio@garr.it> Date: Tue, 25 Jan 2022 14:34:08 +0100 Subject: [PATCH] 20220125 Matteo: update ingress tutorial --- web/containers/ingress.rst | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/web/containers/ingress.rst b/web/containers/ingress.rst index 091e9f47..8dcbedd9 100644 --- a/web/containers/ingress.rst +++ b/web/containers/ingress.rst @@ -25,9 +25,10 @@ Read how to create a valid kubeconfig and how to connect to our k8s cluster here .. code-block:: bash $ helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx + $ helm repo update -2. Install ingress-nginx chart in our k8s namespace +2. Install ingress-nginx chart in our k8s namespace --------------------------------------------------- .. code-block:: bash @@ -44,6 +45,14 @@ Quick explanation of the most significant parameters and values used with the *h - *version 2.16.0*: we use the 2.16 version of the chart in order to be able to install this chart with Kubernetes v1.13. The latest version of the chart is compatible with Kubernetes >=v1.16 only. +**Helm install command for most recent Kubernetes versions**: + +.. code-block:: bash + + $ helm install ingress-nginx ingress-nginx/ingress-nginx --namespace <your-namespace> --set controller.ingressClassResource.name=nginx-controller-custom --set controller.ingressClassResource.controllerValue="k8s.io/nginx-controller-custom" --set controller.ingressClassResource.enabled=true --set controller.ingressClassByName=true --set controller.scope.enabled=true --set controller.scope.namespace=<your-namespace> --set rbac.create=true --set rbac.scope=true -set controller.publishService.enabled=true + + + 3. Test our custom ingress controller ------------------------------------- @@ -81,6 +90,29 @@ Quick explanation of the most significant parameters and values used with the *h **NOTE**: we use the annotation *kubernetes.io/ingress.class: "nginx-controller-custom"* to tell k8s that this ingress resource will be managed by the ingress controller tagged with the 'nginx-controller-custom' ingress class. Also, we tell the ingress controller to point to our test wordpress application in the 'rules' section of the file. + +**Ingress resource for most recent Kubernetes versions** + +.. code-block:: bash + + $ vim ingress.yaml + + apiVersion: networking.k8s.io/v1 + kind: Ingress + metadata: + name: my-ingress + spec: + ingressClassName: nginx-controller-custom + rules: + - http: + paths: + - backend: + serviceName: mywordpress + servicePort: 80` + + + $ kubectl apply -f ingress.yaml + **Test if it is all working properly**: .. code-block:: bash -- GitLab