|
| 1 | +# Mailu setups with the Helm Chart |
| 2 | + |
| 3 | +WIP: This document shall describe and show how Mailu can be setup with the Helm Chart. |
| 4 | + |
| 5 | +> [!IMPORTANT] |
| 6 | +> Routing all traffic, including Web traffic through the Mailu `front` service is done **on purpose** to deliver |
| 7 | +> an integrated service to the users of Mailu. You are free to run components separately, but such setups are not in scope |
| 8 | +> of the Mailu project or the Mailu Helm Chart and are not supported. Using `HTTPS` as backend for the ingress is also a |
| 9 | +> conscious decision and allows for an integrated experience while keeping the scope small for the volunteer dev team. |
| 10 | +
|
| 11 | +## Simple setup |
| 12 | + |
| 13 | +This is a simple setup to make Mailu services available from the internet. |
| 14 | +Cert-manager is used to get a certificate for the Ingress. The same certificate is used by the `front` deployment for |
| 15 | +mail services. |
| 16 | + |
| 17 | +How traffic is routed from a public IP address to individual K8s nodes is out of scope and must be taken care of individually. |
| 18 | +Typically K8s nodes have private IP addresses and a Service of type LoadBalancer is used to make services available on public IPs. |
| 19 | + |
| 20 | +This setup is using a single instance where Mail services will be reachable either through HostPort or |
| 21 | +a Service of type NodePort or LoadBalancer. |
| 22 | + |
| 23 | +```mermaid |
| 24 | +flowchart TD |
| 25 | + %% entities |
| 26 | + Internet(Internet) |
| 27 | + LoadBalancer(LoadBalancer) |
| 28 | +
|
| 29 | + Ingress("`**Ingress** |
| 30 | + service`") |
| 31 | + FrontService("`**NodePort/LoadBalancer** |
| 32 | + service`") |
| 33 | + Front("`**Mailu front** |
| 34 | + single pod`") |
| 35 | + Webmail("`**Mailu webmail** |
| 36 | + single pod`") |
| 37 | + MailServices("`**Mailu smtp/imap...** |
| 38 | + pods`") |
| 39 | +
|
| 40 | +
|
| 41 | + Internet -. NodePort .-> Node1 |
| 42 | + Internet -. NodePort .-> Node2 |
| 43 | + Internet -. "HostPort:\n25/.../995" .-> Front |
| 44 | + Internet -. LoadBalancer .-> LoadBalancer |
| 45 | + LoadBalancer -- 25/.../995 --> FrontService |
| 46 | +
|
| 47 | + subgraph Node1[k8s node 1] |
| 48 | + IngressController1 -- 80/443 --> Ingress |
| 49 | + end |
| 50 | +
|
| 51 | + subgraph Node2[k8s node 2] |
| 52 | + IngressController2 -- 80/443 --> Ingress |
| 53 | +
|
| 54 | + FrontService -- 25/.../995 --> Front |
| 55 | + Ingress -- HTTPS --> Front |
| 56 | +
|
| 57 | + Front --> MailServices |
| 58 | + Front --> Webmail |
| 59 | + end |
| 60 | +``` |
| 61 | + |
| 62 | +### Using HostPort (default) |
| 63 | + |
| 64 | +- Enabled by default through `front.hostPort.enabled=true` |
| 65 | +- Ingress for Webmail (80, 443) |
| 66 | +- Host ports (25, 110, 143, 465, 587, 993, 995) |
| 67 | + - binding ports on the current node (host) directly to the front pod |
| 68 | + |
| 69 | +### Using NodePort |
| 70 | + |
| 71 | +Same as the above, but using a Service of type `NodePort` to bind ports on every node to the external service. |
| 72 | + |
| 73 | +```yaml |
| 74 | +# values.yaml |
| 75 | +front: |
| 76 | + hostPort: |
| 77 | + enabled: false |
| 78 | + externalService: |
| 79 | + enabled: true |
| 80 | + type: NodePort |
| 81 | + nodePort: |
| 82 | + # optionally define specific ports |
| 83 | + imaps: 30995 |
| 84 | +``` |
| 85 | +
|
| 86 | +### Using LoadBalancer |
| 87 | +
|
| 88 | +Again the same as above, but using a Service of type `LoadBalancer` to assign a public IP on which to reach the external service: |
| 89 | + |
| 90 | +```yaml |
| 91 | +# values.yaml |
| 92 | +front: |
| 93 | + hostPort: |
| 94 | + enabled: false |
| 95 | + externalService: |
| 96 | + enabled: true |
| 97 | + type: LoadBalancer |
| 98 | +``` |
| 99 | + |
| 100 | +## K8s nodes with public IPs |
| 101 | + |
| 102 | +> [!WARNING] |
| 103 | +> Traffic between pods is unencrypted, use [istio](https://istio.io/) or similar to ensure traffic between pods of the k8s nodes is encrypted. |
| 104 | + |
| 105 | +If your cluster nodes use public IPs, you can directly access the mail ports from the internet, for example using the |
| 106 | +default HostPort or a NodePort Service described above. |
0 commit comments