apiVersion: v1 kind: Service metadata: name: metrics-service namespace: container-mom annotations: prometheus.io/scrape: "true" prometheus.io/port: "9090" spec: ports: - port: 80 targetPort: 3000 name: http - port: 9090 targetPort: 9090 name: metrics selector: app: metrics-service --- apiVersion: apps/v1 kind: Deployment metadata: name: metrics-service namespace: container-mom spec: replicas: 2 selector: matchLabels: app: metrics-service template: metadata: labels: app: metrics-service spec: containers: - name: metrics image: container-mom-metrics:latest imagePullPolicy: IfNotPresent ports: - containerPort: 3000 name: http - containerPort: 9090 name: metrics env: - name: APP_NAME value: "metrics-service" - name: KEMAL_ENV value: "production" - name: DB_HOST value: "postgres" - name: DB_PORT value: "5432" - name: DB_USER valueFrom: secretKeyRef: name: db-credentials key: username - name: DB_PASSWORD valueFrom: secretKeyRef: name: db-credentials key: password - name: DB_NAME value: "container_mom_production" - name: METRICS_PORT value: "9090" readinessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 5 periodSeconds: 10 livenessProbe: httpGet: path: /health port: 3000 initialDelaySeconds: 15 periodSeconds: 20 resources: requests: memory: "256Mi" cpu: "250m" limits: memory: "512Mi" cpu: "500m" volumeMounts: - name: metrics-storage mountPath: /data volumes: - name: metrics-storage emptyDir: {}