From f7cac7d0c87e44b17c4f71c350fe4b1fce2db8af Mon Sep 17 00:00:00 2001 From: lihongjie0209 Date: Thu, 10 Aug 2023 17:19:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- k8s/base/api.yaml | 4 ++-- k8s/base/kustomization.yaml | 14 +++++++++++++- k8s/base/pg.yaml | 3 +++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/k8s/base/api.yaml b/k8s/base/api.yaml index bb106c59..62f3f51e 100644 --- a/k8s/base/api.yaml +++ b/k8s/base/api.yaml @@ -23,9 +23,9 @@ spec: - containerPort: 7456 env: - name: PG_HOST - value: pg + value: "$(PG_HOST)" - name: REDIS_HOST - value: redis + value: "$(REDIS_HOST)" restartPolicy: Always diff --git a/k8s/base/kustomization.yaml b/k8s/base/kustomization.yaml index a011932a..fb61a168 100644 --- a/k8s/base/kustomization.yaml +++ b/k8s/base/kustomization.yaml @@ -1,4 +1,16 @@ resources: - api.yaml - redis.yaml - - pg.yaml \ No newline at end of file + - pg.yaml + + + +vars: + - name: PG_HOST + objref: + kind: Service + name: pg + - name: REDIS_HOST + objref: + kind: Service + name: redis diff --git a/k8s/base/pg.yaml b/k8s/base/pg.yaml index 5ada0159..2bb0ebbd 100644 --- a/k8s/base/pg.yaml +++ b/k8s/base/pg.yaml @@ -31,6 +31,9 @@ spec: terminationGracePeriodSeconds: 10 containers: - name: pg + securityContext: + runAsUser: 3001 + runAsGroup: 3001 image: postgres ports: - containerPort: 5432