![](https://file.jishuzhan.net/article/1788487367040962561/d1eeb7299744458066931992a5a53b84.webp)
![](https://file.jishuzhan.net/article/1788487367040962561/69c7102cd85a8990f18acfdeac93e177.webp)
apiVersion: v1
kind: Service
metadata:
name: deploy-service
labels:
app: deploy-service
spec:
ports:
- port: 80
targetPort: 80
name: deploy-service-pod
selector:
app: deploy-pod
type: NodePort
![](https://file.jishuzhan.net/article/1788487367040962561/455c12d79c90cd3409f1ce75022c680f.webp)
service 的 endPoint (ep)
![](https://file.jishuzhan.net/article/1788487367040962561/862488b7292441e42b6187d6454d74f4.webp)
![](https://file.jishuzhan.net/article/1788487367040962561/3474f8b60f4af56e6e66b3cb0868dcd0.webp)
主机端口分配方式
两个 name
![](https://file.jishuzhan.net/article/1788487367040962561/8fffc8274ea2dcd6522ac31ce42ff61c.webp)
port 和 targetPort
![](https://file.jishuzhan.net/article/1788487367040962561/1a3f4f1ea3323b91616c86960495315a.webp)
type 类型
![](https://file.jishuzhan.net/article/1788487367040962561/3d1ef4ccb9fb5b03c597d3800e49dfbd.webp)
![](https://file.jishuzhan.net/article/1788487367040962561/87ebdb312178276350f9adaf4aff5564.webp)
![](https://file.jishuzhan.net/article/1788487367040962561/5977c7750c3b7156460a5a301d74a89f.webp)