# Simple deployment of retail store sample app # 1 deployment for each component, pod will spread among nodes apiVersion: apps/v1 kind: Deployment metadata: labels: app.kubernetes.io/created-by: retail-store-sample app.kubernetes.io/type: app name: catalog namespace: catalog spec: replicas: 3 selector: matchLabels: app.kubernetes.io/component: service app.kubernetes.io/instance: catalog app.kubernetes.io/name: catalog template: metadata: annotations: instrumentation.opentelemetry.io/inject-sdk: opentelemetry/default-instrumentation prometheus.io/path: /metrics prometheus.io/port: "8080" prometheus.io/scrape: "true" labels: app.kubernetes.io/component: service app.kubernetes.io/created-by: retail-store-sample app.kubernetes.io/instance: catalog app.kubernetes.io/name: catalog spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - podAffinityTerm: labelSelector: matchExpressions: - key: app.kubernetes.io/name operator: In values: - catalog topologyKey: topology.kubernetes.io/zone weight: 100 containers: - env: - name: OTEL_SERVICE_NAME valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.name - name: DB_ENDPOINT valueFrom: secretKeyRef: key: endpoint name: catalog-db - name: DB_USER valueFrom: secretKeyRef: key: username name: catalog-db - name: DB_PASSWORD valueFrom: secretKeyRef: key: password name: catalog-db - name: DB_READ_ENDPOINT valueFrom: secretKeyRef: key: endpoint name: catalog-db - name: DB_NAME valueFrom: secretKeyRef: key: name name: catalog-db envFrom: - configMapRef: name: catalog image: public.ecr.aws/aws-containers/retail-store-sample-catalog:0.2.0 imagePullPolicy: IfNotPresent livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 30 periodSeconds: 3 name: catalog ports: - containerPort: 8080 name: http protocol: TCP readinessProbe: httpGet: path: /health port: 8080 periodSeconds: 5 successThreshold: 3 resources: limits: memory: 256Mi requests: cpu: 128m memory: 256Mi securityContext: capabilities: drop: - ALL readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 volumeMounts: - mountPath: /tmp name: tmp-volume securityContext: fsGroup: 1000 serviceAccountName: catalog volumes: - emptyDir: medium: Memory name: tmp-volume --- apiVersion: apps/v1 kind: Deployment metadata: labels: app.kubernetes.io/created-by: retail-store-sample app.kubernetes.io/type: app name: ui namespace: ui spec: replicas: 3 selector: matchLabels: app.kubernetes.io/component: service app.kubernetes.io/instance: ui app.kubernetes.io/name: ui template: metadata: annotations: instrumentation.opentelemetry.io/inject-sdk: opentelemetry/default-instrumentation prometheus.io/path: /actuator/prometheus prometheus.io/port: "8080" prometheus.io/scrape: "true" labels: app.kubernetes.io/component: service app.kubernetes.io/created-by: retail-store-sample app.kubernetes.io/instance: ui app.kubernetes.io/name: ui spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - podAffinityTerm: labelSelector: matchExpressions: - key: app.kubernetes.io/name operator: In values: - ui topologyKey: topology.kubernetes.io/zone weight: 100 containers: - env: - name: ENDPOINTS_HTTP_KEEPALIVE value: "false" - name: OTEL_SERVICE_NAME valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.name - name: JAVA_OPTS value: -XX:MaxRAMPercentage=75.0 -Djava.security.egd=file:/dev/urandom envFrom: - configMapRef: name: ui image: public.ecr.aws/aws-containers/retail-store-sample-ui:0.2.0 imagePullPolicy: IfNotPresent livenessProbe: httpGet: path: /actuator/health/liveness port: 8080 initialDelaySeconds: 45 periodSeconds: 20 name: ui ports: - containerPort: 8080 name: http protocol: TCP resources: limits: memory: 512Mi requests: cpu: 128m memory: 512Mi securityContext: capabilities: add: - NET_BIND_SERVICE drop: - ALL readOnlyRootFilesystem: true runAsNonRoot: true runAsUser: 1000 volumeMounts: - mountPath: /tmp name: tmp-volume securityContext: fsGroup: 1000 serviceAccountName: ui volumes: - emptyDir: medium: Memory name: tmp-volume