"NodePort"和"LoadBalancer"服务类型有什么区别?

4
apiVersion: v1
kind: Service
metadata:
  name: nginx 
  labels:
    name: nginx
spec:
  ports:
    # the port that this service should serve on
  - port: 80 
    targetPort: 80
    nodePort: 30000 
  selector:
    name: nginx
  type: NodePort

apiVersion: v1
kind: Service
metadata:
  name: nginx 
  labels:
    name: nginx
spec:
  ports:
    # the port that this service should serve on
  - port: 80 
    targetPort: 80
    nodePort: 30000 
  selector:
    name: nginx
  type: LoadBalancer 

两种方法都支持负载均衡器。 端口范围在30000-32000之间,为什么? 如果我想使用端口3000,我该怎么做?

1个回答

2

1
这个答案解释了NodePort是什么,但没有解释它在实践中与LoadBalancer的区别,我认为这就是提问者所问的。 - Blaszard
该URL不存在。 - yasin lachini

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接