I am working on a project where the requirement just came to create a pod for MTA/SMTP within Kubernetes cluster such that it can be accessed through discovery like other services.
Didn't find anything concrete that I could follow to set up this on a Kubernetes cluster. My question is if there's any way to do this then how? also, is it a good idea to set up it as pod?
Will appreciate any help.
Thanks
You sure can. It's more about opinion and really depends on how you divide your resources into containers or VMs or bare-metal machines.
Some might argue that running something like postfix is more efficient in Kubernetes because the CPU/Memory resources will mostly be used when postfix is actually sending/receiving (a more efficient way of processing the mail queues). There are a few resources that you may able to follow. For example:
It's actually relatively simple to deploy a Postfix MTA relay on Kubernetes (aka Postfix null client).
There's:
(Disclaimer: I am the author of the chart and image. There are other alternatives, listed on the said GitHub page)
Service can then be simply accessed via smtp-server:587
or similar resolution. The biggest issue you're going to face is configuring the outside services (such as SPF, DNS, registering your block with Microsoft) properly to avoid having your email going into spam.
Most of it is explained nicely in the README.