|
1 | 1 | # Ingress Setup
|
2 | 2 |
|
3 |
| -After Devtron is installed, Devtron is accessible through service `devtron-service`. |
4 |
| -If you want to access Devtron through ingress, edit `devtron-service` and change the loadbalancer to ClusterIP. You can do this using `kubectl patch` command: |
| 3 | +## Introduction |
| 4 | + |
| 5 | +If you wish to use [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) as a means to access the Devtron services available in your cluster, you can configure it either during the installation or after the installation of Devtron. |
| 6 | + |
| 7 | +Refer the section relevant to you: |
| 8 | +* [During Devtron Installation](#enabling-ingress-during-devtron-installation) |
| 9 | +* [After Devtron Installation](#configuring-ingress-after-devtron-installation) |
| 10 | + |
| 11 | +If you have successfully configured Ingress, refer [Post Ingress Setup](#enable-https-for-devtron). |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Enabling Ingress during Devtron Installation |
| 16 | + |
| 17 | +If you are installing Devtron, you can enable Ingress either via [set flag](#using-set-flag) or by using [ingress-values.yaml](#using-ingress-values.yaml) to specify the desired Ingress settings. |
| 18 | + |
| 19 | +### Using set flag |
| 20 | + |
| 21 | +You can use the `--set` flag to specify the desired Ingress settings. |
| 22 | + |
| 23 | +Here, we have added 5 configurations you can perform depending on your requirements: |
| 24 | +* [Only Basic Configuration](#only-basic-configuration) |
| 25 | +* [Configuration Including Labels](#configuration-including-labels) |
| 26 | +* [Configuration Including Annotations](#configuration-including-annotations) |
| 27 | +* [Configuration Including TLS Settings](#configuration-including-tls-settings) |
| 28 | +* [Comprehensive Configuration](#comprehensive-configuration) |
| 29 | + |
| 30 | +#### Only Basic Configuration |
| 31 | + |
| 32 | +To enable Ingress and set basic parameters, use the following command: |
| 33 | + |
| 34 | +```bash |
| 35 | +helm install devtron devtron/devtron-operator -n devtroncd \ |
| 36 | + --set components.devtron.ingress.enabled=true \ |
| 37 | + --set components.devtron.ingress.className=nginx \ |
| 38 | + --set components.devtron.ingress.host=devtron.example.com |
| 39 | +``` |
| 40 | + |
| 41 | +#### Configuration Including Labels |
| 42 | + |
| 43 | +To add labels to the Ingress resource, use the following command: |
| 44 | + |
| 45 | +```bash |
| 46 | +helm install devtron devtron/devtron-operator -n devtroncd \ |
| 47 | + --set components.devtron.ingress.enabled=true \ |
| 48 | + --set components.devtron.ingress.className=nginx \ |
| 49 | + --set components.devtron.ingress.host=devtron.example.com \ |
| 50 | + --set components.devtron.ingress.labels.env=production |
| 51 | +``` |
| 52 | + |
| 53 | +#### Configuration Including Annotations |
| 54 | + |
| 55 | +To add annotations to the Ingress resource, use the following command: |
| 56 | + |
| 57 | +```bash |
| 58 | +helm install devtron devtron/devtron-operator -n devtroncd \ |
| 59 | + --set components.devtron.ingress.enabled=true \ |
| 60 | + --set components.devtron.ingress.className=nginx \ |
| 61 | + --set components.devtron.ingress.host=devtron.example.com \ |
| 62 | + --set components.devtron.ingress.annotations."kubernetes\.io/ingress\.class"=nginx \ |
| 63 | + --set components.devtron.ingress.annotations."nginx\.ingress\.kubernetes\.io\/app-root"="/dashboard" |
| 64 | +``` |
| 65 | + |
| 66 | +#### Configuration Including TLS Settings |
| 67 | + |
| 68 | +To configure TLS settings, including `secretName` and `hosts`, use the following command: |
| 69 | + |
| 70 | +```bash |
| 71 | +helm install devtron devtron/devtron-operator -n devtroncd \ |
| 72 | + --set components.devtron.ingress.enabled=true \ |
| 73 | + --set components.devtron.ingress.className=nginx \ |
| 74 | + --set components.devtron.ingress.host=devtron.example.com \ |
| 75 | + --set components.devtron.ingress.tls[0].secretName=devtron-tls \ |
| 76 | + --set components.devtron.ingress.tls[0].hosts[0]=devtron.example.com |
| 77 | +``` |
| 78 | + |
| 79 | +#### Comprehensive Configuration |
| 80 | + |
| 81 | +To include all the above settings in a single command, use: |
| 82 | + |
| 83 | +```bash |
| 84 | +helm install devtron devtron/devtron-operator -n devtroncd \ |
| 85 | + --set components.devtron.ingress.enabled=true \ |
| 86 | + --set components.devtron.ingress.className=nginx \ |
| 87 | + --set components.devtron.ingress.host=devtron.example.com \ |
| 88 | + --set components.devtron.ingress.annotations."kubernetes\.io/ingress\.class"=nginx \ |
| 89 | + --set components.devtron.ingress.annotations."nginx\.ingress\.kubernetes\.io\/app-root"="/dashboard" \ |
| 90 | + --set components.devtron.ingress.labels.env=production \ |
| 91 | + --set components.devtron.ingress.pathType=ImplementationSpecific \ |
| 92 | + --set components.devtron.ingress.tls[0].secretName=devtron-tls \ |
| 93 | + --set components.devtron.ingress.tls[0].hosts[0]=devtron.example.com |
| 94 | +``` |
| 95 | + |
| 96 | + |
| 97 | +### Using ingress-values.yaml |
| 98 | + |
| 99 | +As an alternative to the [set flag](#using-set-flag) method, you can enable Ingress using `ingress-values.yaml` instead. |
| 100 | + |
| 101 | +Create an `ingress-values.yaml` file. You may refer the below format for an advanced ingress configuration which includes labels, annotations, secrets, and many more. |
| 102 | + |
| 103 | +```yml |
| 104 | +components: |
| 105 | + devtron: |
| 106 | + ingress: |
| 107 | + enabled: true |
| 108 | + className: nginx |
| 109 | + labels: {} |
| 110 | + # env: production |
| 111 | + annotations: {} |
| 112 | + # nginx.ingress.kubernetes.io/app-root: /dashboard |
| 113 | + pathType: ImplementationSpecific |
| 114 | + host: devtron.example.com |
| 115 | + tls: [] |
| 116 | + # - secretName: devtron-info-tls |
| 117 | + # hosts: |
| 118 | + # - devtron.example.com |
| 119 | +``` |
| 120 | + |
| 121 | +Once you have the `ingress-values.yaml` file ready, run the following command: |
| 122 | + |
| 123 | +```bash |
| 124 | +helm install devtron devtron/devtron-operator -n devtroncd --reuse-values -f ingress-values.yaml |
| 125 | +``` |
| 126 | + |
| 127 | +--- |
| 128 | + |
| 129 | +## Configuring Ingress after Devtron Installation |
| 130 | + |
| 131 | +After Devtron is installed, Devtron is accessible through `devtron-service`. If you wish to access Devtron through ingress, you'll need to modify this service to use a ClusterIP instead of a LoadBalancer. |
| 132 | + |
| 133 | +You can do this using the `kubectl patch` command: |
5 | 134 |
|
6 | 135 | ```bash
|
7 | 136 | kubectl patch -n devtroncd svc devtron-service -p '{"spec": {"ports": [{"port": 80,"targetPort": "devtron","protocol": "TCP","name": "devtron"}],"type": "ClusterIP","selector": {"app": "devtron"}}}'
|
8 | 137 | ```
|
9 | 138 |
|
10 |
| -After this, create ingress by applying the ingress yaml file. |
11 |
| -You can use [this yaml file](https://github.com/devtron-labs/devtron/blob/main/manifests/yamls/devtron-ingress.yaml) to create ingress to access Devtron: |
| 139 | +Next, create ingress to access Devtron by applying the `devtron-ingress.yaml` file. The file is also available on this [link](https://github.com/devtron-labs/devtron/blob/main/manifests/yamls/devtron-ingress.yaml). You can access Devtron from any host after applying this yaml. |
12 | 140 |
|
13 |
| -```yaml |
| 141 | +```yml |
14 | 142 | apiVersion: networking.k8s.io/v1
|
15 | 143 | kind: Ingress
|
16 | 144 | metadata:
|
|
49 | 177 | pathType: ImplementationSpecific
|
50 | 178 | ```
|
51 | 179 |
|
52 |
| -You can access Devtron from any host after applying this yaml. For k8s versions <1.19, [apply this yaml](https://github.com/devtron-labs/devtron/blob/main/manifests/yamls/devtron-ingress-legacy.yaml): |
| 180 | +For k8s versions < 1.19, [apply this yaml](https://github.com/devtron-labs/devtron/blob/main/manifests/yamls/devtron-ingress-legacy.yaml): |
53 | 181 |
|
54 |
| -```yaml |
| 182 | +```yml |
55 | 183 | apiVersion: extensions/v1beta1
|
56 | 184 | kind: Ingress
|
57 | 185 | metadata:
|
|
79 | 207 |
|
80 | 208 | Optionally, you also can access Devtron through a specific host by running the following YAML file:
|
81 | 209 |
|
82 |
| -```yaml |
| 210 | +```yml |
83 | 211 | apiVersion: networking.k8s.io/v1
|
84 | 212 | kind: Ingress
|
85 | 213 | metadata:
|
@@ -119,9 +247,11 @@ spec:
|
119 | 247 | pathType: ImplementationSpecific
|
120 | 248 | ```
|
121 | 249 |
|
| 250 | +--- |
| 251 | +
|
122 | 252 | ## Enable HTTPS For Devtron
|
123 | 253 |
|
124 |
| -Once ingress setup for devtron is done and you want to run Devtron over `https`, you need to add different annotations for different ingress controllers and load balancers. |
| 254 | +Once Ingress setup for Devtron is done and you want to run Devtron over `https`, you need to add different annotations for different ingress controllers and load balancers. |
125 | 255 |
|
126 | 256 | ### 1. Nginx Ingress Controller
|
127 | 257 |
|
@@ -175,7 +305,4 @@ In case of AWS application load balancer, the following annotations need to be a
|
175 | 305 | ```
|
176 | 306 | For an Ingress resource to be observed by AGIC (Application Gateway Ingress Controller) must be annotated with kubernetes.io/ingress.class: azure/application-gateway. Only then AGIC will work with the Ingress resource in question.
|
177 | 307 |
|
178 |
| -> Note: Make sure NOT to use port 80 with HTTPS and port 443 with HTTP on the Pods. |
179 |
| - |
180 |
| - |
181 |
| - |
| 308 | +> Note: Make sure NOT to use port 80 with HTTPS and port 443 with HTTP on the Pods. |
0 commit comments