Background
By default the Virtru gateway will store messages in the container temporarily in a postfix queue until the message can be delivered. This is ok in some situations but it is encouraged to move that postfix queue to an external volume so that the queue can persist through any changes in the container environment and no mail is lost.
Below are the steps for creating a persistent volume claim and mapping the internal postfix queue to that persistent volume.
Assumptions:
- You have already created a gateway service in your project from this article
- My storage claim is called
myclaim
this can be your choice - My storage size is
1 Gig
this can be increased or decreased depending on your needs - My namespace is
virtru-oe
Create a Persistent claim volume
- Connect to your cluster using Cloud Shell
- Kubernetes Engine>Clusters>(cluster name)
- In the top right corner click on the "Activate Cloud Shell" icon
- Click on "Open Editor"
- Create a
pvc.yaml
file and apply it to the cluster- Right click in the Explorer and create a new file
- Give the file a name "pvc.yaml" for example
- Right click in the Explorer and create a new file
- Copy the contents of the yaml below
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: myclaim
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- To apply the yaml run the following command in your cloud shell terminal in the top right of your editor
- Apply the persistent volume claim to your namespace that the gateway application is running in by running the following command
(In my example I am applying the to the name spacevirtru-oe
)
kubectl apply -n virtru-oe -f pvc.yaml
Mount queue to persistent volume
- Then navigate to workloads in your kubernetes engine.
- Kubernetes engine>Workloads>(application name)
- Add the following lines deployment yaml to map the postfix queue directory inside of the containers to the persistent volume that we just created.
- Click on the YAML tab and click edit
- Under the name
gateway
add the following lines under the existing volume mount (roughly around line 296 in the yaml)
- Click on the YAML tab and click edit
- mountPath: /var/spool/postfix
name: postfix-dir
-
- Under the same name scroll down to around line 325 add the new volume name and claim to the existing
volumes
- Under the same name scroll down to around line 325 add the new volume name and claim to the existing
- name: postfix-dir
persistantVolumeClaim:
claimName:myclaim
-
- Save the Yaml and the changes should take effect right away.
Screenshot example of the above additions in context with the existing YAML: