Gitlab Server on Google Kubernetes Engine mail configuration

1/13/2021

Recently I installed a new GitLab Server in a Kubernetes cluster running on GKE. I followed this documentation:

I used Helm 3 instead Helm 2.

Now I needed to configure a mail server to send emails to each operation (new user, pipelines, etc.) but I didn't find how to do that in this documentation. I found a doc (https://docs.gitlab.com/omnibus/settings/smtp.html#example-configurations) but is useful only in GitLab installed in virtual machines, also I looked in the replicaset and deployment, but I can't find it.

How can I access my configurations in my GitLab Server?

  • GitLab version: 13.7.0
  • Helm chart: gitlab-4.7.0
-- Julio Back
gitlab
google-kubernetes-engine
kubernetes

1 Answer

1/14/2021

As asked in the question:

How can I access my configurations in my GitLab Server? GitLab version: 13.7.0 Helm chart: gitlab-4.7.0

You already accessed some of the configuration of your Gitlab by your values.yaml file. This is the file that stores the configuration of the resources you will be (or was) deploying.

By following one of the parts of the official documentation:

You created your own values.yaml and used it to override the values (only some) of the values.yaml file in the Helm Chart.

To pass additional configuration to your Gitlab you could either:

  • Pull the whole gitlab chart, modify it's values.yaml and run it from local source:
    • $ helm pull gitlab/gitlab --untar
    • edit the gitlab/values.yaml file
    • $ helm install gitlab gitlab/ -f gcp-values.yaml (gcp-values.yaml is the values from GCP guide and it's in the preceding directory)
  • Add to your previously created values.yaml configuration that is responsible for managing email communication (add to the values.yaml from GCP guide).

There are multiple parts responsible for mail communication in the Gitlab values.yaml.

For example, there is a part responsible for handling outgoing messages under global.smtp section:

  ## doc/installation/deployment.md#outgoing-email
  ## Outgoing email server settings
  smtp:
    enabled: false
    address: smtp.mailgun.org
    port: 2525
    user_name: ""
    ## doc/installation/secrets.md#smtp-password
    password:
      secret: ""
      key: password
    # domain:
    authentication: "plain"
    starttls_auto: false
    openssl_verify_mode: "peer"

  ## doc/installation/deployment.md#outgoing-email
  ## Email persona used in email sent by GitLab
  email:
    from: ''
    display_name: GitLab
    reply_to: ''
    subject_suffix: ''
    smime:
      enabled: false
      secretName: ""
      keyName: "tls.key"
      certName: "tls.crt"

There are also parts for incoming messages, service desk etc.. You will need to check for yourself and configure it to match your needs.

The site that you mentioned:

Could be a good reference/guide when modifying the values.yaml file to support the mail configuration of your choosing.

I also encourage you to also check this site for incoming emails configuration.


As for mail communication in GKE.

GKE nodes are in fact GCE VM's and they are under certain limitations:

Sending email from an instance

This document describes the options for sending mail from a virtual machine (VM) instance and provides general recommendations on how to set up your instances to send email.

Using standard email ports

Due to the risk of abuse, connections to destination TCP Port 25 are always blocked when the destination is external to your VPC network. This includes using SMTP relay with Google Workspace.

Google Cloud does not place any restrictions on traffic sent to external destination IP addresses using destination TCP ports 587 or 465.

-- Cloud.google.com: Compute: Docs: Tutorials: Sending mail

Following on the above link:

I've managed to use one of the mentioned external mail service providers to configure the outgoing email communication on my Gitlab instance. You can choose one that suits your needs the most.

You can also check this ServerFault answer which provides some additional information:

-- Dawid Kruk
Source: StackOverflow