[root@master Chapter6]# cat service.yaml
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: myapp
ports:
- port: 80
targetPort: 9376
targetPort: 9376 容器内的端口 9376
port :80 对外开放端口
[root@master Chapter6]# cat service.yaml
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: myapp
ports:
- port: 80
targetPort: 9376
[root@master Chapter6]# kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.1.0.1 &
kubernetes 中的service 对外暴露端口
最新推荐文章于 2024-04-19 16:07:21 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)