From a6a7d9b413ec19017db62e35a328106858c5d979 Mon Sep 17 00:00:00 2001 From: Igor Shishkin Date: Wed, 19 Jun 2024 09:43:40 +0300 Subject: [PATCH] Add k8s configuration example Signed-off-by: Igor Shishkin --- examples/k8s/README.md | 3 ++ examples/k8s/deployment.yaml | 99 ++++++++++++++++++++++++++++++++++++ examples/k8s/service.yaml | 22 ++++++++ 3 files changed, 124 insertions(+) create mode 100644 examples/k8s/README.md create mode 100644 examples/k8s/deployment.yaml create mode 100644 examples/k8s/service.yaml diff --git a/examples/k8s/README.md b/examples/k8s/README.md new file mode 100644 index 0000000..e90605a --- /dev/null +++ b/examples/k8s/README.md @@ -0,0 +1,3 @@ +# examples/k8s + +k8s example shows simple configuration into kubernetes cluster. diff --git a/examples/k8s/deployment.yaml b/examples/k8s/deployment.yaml new file mode 100644 index 0000000..0aa082c --- /dev/null +++ b/examples/k8s/deployment.yaml @@ -0,0 +1,99 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: relay + labels: + app.kubernetes.io/name: relay + app.kubernetes.io/app: relay + app.kubernetes.io/app-kind: smtp-server +spec: + replicas: 3 + strategy: + type: RollingUpdate + revisionHistoryLimit: 10 + selector: + matchLabels: + app.kubernetes.io/name: relay + app.kubernetes.io/app: relay + app.kubernetes.io/app-kind: smtp-server + template: + metadata: + labels: + app.kubernetes.io/name: relay + app.kubernetes.io/app: relay + app.kubernetes.io/app-kind: smtp-server + spec: + terminationGracePeriodSeconds: 30 + containers: + - name: relay + image: ghcr.io/teran/relay:v0.2.0 + env: + - name: LOG_LEVEL + value: trace + - name: ADDR + value: :25 + - name: ENABLE_TLS + value: "false" + # - name: TLS_ADDR + # value: :465 + # - name: TLS_CERTIFICATE + # valueFrom: + # secretKeyRef: + # name: relay + # key: tls_certificate + # - name: TLS_KEY + # valueFrom: + # secretKeyRef: + # name: relay + # key: tls_key + - name: ALLOW_INSECURE_AUTH + value: "true" + - name: DOMAIN + value: "example.org" + - name: DRIVER + value: printer + # - name: DRIVER + # value: mailgun + # - name: MAILGUN_API_KEY + # valueFrom: + # secretKeyRef: + # name: relay + # key: mailgun_api_key + # - name: MAILGUN_URL + # valueFrom: + # secretKeyRef: + # name: relay + # key: mailgun_url + - name: METRICS_ADDR + value: :8081 + imagePullPolicy: IfNotPresent + ports: + - name: smtp + containerPort: 25 + protocol: TCP + # - name: smtps + # containerPort: 465 + # protocol: TCP + - name: metrics + containerPort: 8081 + protocol: TCP + readinessProbe: + httpGet: + path: /metrics + port: metrics + timeoutSeconds: 1 + livenessProbe: + httpGet: + path: /metrics + port: metrics + timeoutSeconds: 1 + resources: + requests: + memory: 128Mi + cpu: 10m + limits: + memory: 128Mi + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true diff --git a/examples/k8s/service.yaml b/examples/k8s/service.yaml new file mode 100644 index 0000000..9388cbb --- /dev/null +++ b/examples/k8s/service.yaml @@ -0,0 +1,22 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: relay + labels: + app.kubernetes.io/name: relay + app.kubernetes.io/app: relay + app.kubernetes.io/app-kind: smtp-server +spec: + ports: + - name: smtp + port: 25 + protocol: TCP + # - name: smtps + # port: 465 + # protocol: TCP + selector: + app.kubernetes.io/name: relay + app.kubernetes.io/app: relay + app.kubernetes.io/app-kind: smtp-server + type: ClusterIP