user11325205
user11325205

Reputation: 11

Kubernetes Cronjob and SMTP

Situation: I have a php-apache web browser in a Kubernetes namespace that is controlled by an Ingress. The ingress exposes the web browser to the public IP within the organization, so its intranet and not internet. The website works well. The organization has smpt server which is configured into php.ini on the web server. The website can trigger email to members of the organization on both the application or logging into the pod and executing the PHP script. The PHP's mail funciton uses sendmail and sends the email.

Problem: I configured a Cronjob and there are a few PHP scripts executed during this process. These scripts similar to the PHP scripts on the web server, will trigger email depending on the conditions. The php.ini is configured with organization's smtp host and port as for the web server, however, email could not be sent outside of the cluster, so the smtp server doesn't post it to the ingress from my understanding. I tried linking the web service to Cronjob and a few configurations broke the website, but no success in sending email from the Cronjob.

However, Cronjob scripts can communicate with organization's API as the web server, except email.

Request: Any example of enabling email functionality within the cronjob would be much appreciated. This doesn't include any separate mail server to be configured for the application within the Kubernetes namespace or cluster.

Upvotes: 0

Views: 9

Answers (0)

Related Questions