apiVersion: v1 kind: Service metadata: name: agent-api labels: app.kubernetes.io/name: agent-api spec: type: ClusterIP selector: app.kubernetes.io/name: agent-api # 必须和 Pod 的标签一致,否则 Service 没有后端 ports: - name: http port: 80 targetPort: http