From 0637e6f0a48ecebae25d9d972934afeee2c23197 Mon Sep 17 00:00:00 2001 From: cover <425886284@qq.com> Date: Tue, 16 Jan 2024 23:01:36 +0800 Subject: [PATCH] =?UTF-8?q?add=20k8s=20yml=20=F0=9F=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- k8s/application.yml | 10 ++++++++++ k8s/deployment.yml | 27 +++++++++++++++++++++++---- k8s/kustomization.yml | 14 ++++++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 k8s/application.yml create mode 100644 k8s/kustomization.yml diff --git a/k8s/application.yml b/k8s/application.yml new file mode 100644 index 0000000..282367e --- /dev/null +++ b/k8s/application.yml @@ -0,0 +1,10 @@ +polar: + greeting: Welcome to the book catalog from a development Kubernetes environment! +spring: + datasource: + url: jdbc:postgresql://polar-postgres/polardb_catalog + security: + oauth2: + resourceserver: + jwt: + issuer-uri: http://polar-keycloak/realms/PolarBookshop diff --git a/k8s/deployment.yml b/k8s/deployment.yml index a33142a..584406e 100644 --- a/k8s/deployment.yml +++ b/k8s/deployment.yml @@ -13,6 +13,10 @@ spec: metadata: labels: app: catalog-service + annotations: + prometheus.io/scrape: "true" + prometheus.io/path: /actuator/prometheus + prometheus.io/port: "9001" spec: containers: - name: catalog-service @@ -27,9 +31,24 @@ spec: env: - name: BPL_JVM_THREAD_COUNT value: "50" - - name: SPRING_CLOUD_CONFIG_URI - value: http://config-service - - name: SPRING_DATASOURCE_URL - value: jdbc:postgresql://polar-postgres/polardb_catalog - name: SPRING_PROFILES_ACTIVE value: testdata + livenessProbe: + httpGet: + path: /actuator/health/liveness + port: 9001 + initialDelaySeconds: 10 + periodSeconds: 5 + readinessProbe: + httpGet: + path: /actuator/health/readiness + port: 9001 + initialDelaySeconds: 5 + periodSeconds: 15 + volumeMounts: + - name: catalog-config-volume + mountPath: /workspace/config + volumes: + - name: catalog-config-volume + configMap: + name: catalog-config diff --git a/k8s/kustomization.yml b/k8s/kustomization.yml new file mode 100644 index 0000000..52398a7 --- /dev/null +++ b/k8s/kustomization.yml @@ -0,0 +1,14 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - deployment.yml + - service.yml + +configMapGenerator: + - name: catalog-config + files: + - application.yml + options: + labels: + app: catalog-service