--- apiVersion: apps/v1 kind: Deployment metadata: name: inventoryservice spec: replicas: 1 template: metadata: labels: app: inventoryservice annotations: prometheus.io/scrape: "true" prometheus.io/path: "/metrics" prometheus.io/port: "80" spec: containers: - name: inventoryservice image: inventoryservice:latest ports: - containerPort: 80 env: - name: ASPNETCORE_URLS value: http://*:80 resources: requests: memory: "128Mi" cpu: "150m" limits: memory: "256Mi" cpu: "200m" selector: matchLabels: app: inventoryservice --- apiVersion: v1 kind: Service metadata: name: inventoryservice labels: app: inventoryservice spec: type: LoadBalancer ports: - port: 8081 targetPort: 80 nodePort: 32002 name: inventoryport selector: app: inventoryservice --- apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: inventoryservice-hpa spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: inventoryservice minReplicas: 1 maxReplicas: 3 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 80