容器网络实例
服务中的3个端口设置
这几个port的概念很容易混淆,比如创建如下service:
apiVersion: v1
kind: Service
metadata:
labels:
name: app1
name: app1
namespace: default
spec:
type: NodePort
ports:
- <strong>port: 8080
targetPort: 8080
nodePort: 30062</strong>
selector:
name: app1
port
The port that the service is exposed on the service’s cluster ip (virsual ip). Port is the service port which is accessed by others with cluster ip.
即,这里的port表示:service暴露在cluster ip上的端口,<cluster ip>:port 是提供给集群内部客户访问service的入口。
nodePort
On top of having a cluster-internal IP, ex