# Kubernetes Service 配置 # 包含:API Service、Metrics Service、Redis Service --- # API Service - 对外暴露 HTTP 服务 apiVersion: v1 kind: Service metadata: name: functional-scaffold-api labels: app: functional-scaffold component: api spec: type: ClusterIP ports: - port: 80 targetPort: 8000 protocol: TCP name: http selector: app: functional-scaffold component: api --- # Metrics Service - Prometheus 抓取指标 apiVersion: v1 kind: Service metadata: name: functional-scaffold-metrics labels: app: functional-scaffold component: api annotations: prometheus.io/scrape: "true" prometheus.io/port: "8000" prometheus.io/path: "/metrics" spec: type: ClusterIP ports: - port: 8000 targetPort: 8000 protocol: TCP name: metrics selector: app: functional-scaffold component: api --- # Redis Service - 内部 Redis 服务 apiVersion: v1 kind: Service metadata: name: functional-scaffold-redis labels: app: functional-scaffold component: redis spec: type: ClusterIP ports: - port: 6379 targetPort: 6379 protocol: TCP name: redis selector: app: functional-scaffold component: redis