问题描述
我有一个暴露为type = LoadBalancer的服务,当我执行
I have a service exposed of type=LoadBalancer and when I do a
kubectl describe services servicename
,
我得到以下输出:
Name: ser1
Namespace: default
Labels: app=online1
Selector: app=online1
Type: LoadBalancer
IP: 10.0.0.32
External IPs: 192.168.99.100
Port: <unset> 8080/TCP
NodePort: <unset> 30545/TCP
Endpoints: 172.17.0.10:8080,172.17.0.11:8080,172.17.0.8:8080 + 1 more...
Session Affinity: None
有人可以指导以下疑问吗?
Can someone please guide on the following doubts :
1.)我不明白<unset>
在端口和NodePort中的含义.另外,它如何影响我的服务?
1.) I can't understand what <unset>
means in Port and NodePort. Also, how does it affect my service?
2.)当我想点击某项服务时,我使用<external-ip:NodePort>
点击了该服务,对吗?那港口有什么用?
2.) When I want to hit a service, I hit the service using <external-ip:NodePort>
right? Then what's the use of Port?
推荐答案
未设置端口的意思是:您没有在服务创建中指定名称.
Port unset means: You didn't specify a name in service creation.
服务Yaml摘录(请注意name: grpc
):
Service Yaml excerpt (note name: grpc
):
spec:
ports:
- port: 26257
targetPort: 26257
name: grpc
type: NodePort
kubectl describe services servicename
输出摘录:
Type: NodePort
IP: 10.101.87.248
Port: grpc 26257/TCP
NodePort: grpc 31045/TCP
Endpoints: 10.20.12.71:26257,10.20.12.73:26257,10.20.8.81:26257
端口是服务将在(实际端点)上发送流量的容器端口的定义.
Port is definition of container ports that service will send the traffic on (Actual Endpoint).
这篇关于Kubernetes-什么是< unset>服务中的港口意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!