website/content/zh-cn/examples/service/nginx-service.yaml

16 lines
467 B
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
ports:
- port: 8000 # 在每个 Pod 的容器上要使用的端口;
# 服务将在此端口上运行,接受连接。
# 端口可以是一个名称例如“www”或一个数字例如80
targetPort: 80
protocol: TCP
# 就像 Deployment 中的选择算符,
# 但这里用于识别要对流量进行负载均衡的 Pod 集合。
selector:
app: nginx