我在 Docker-Desktop 上启用了 Kubernetes 并创建了一个 LoadBalancer 类型的服务,定义为:
apiVersion: v1
kind: Service
metadata:
name: mongo-express-service
spec:
selector:
app: mongo-express
type: LoadBalancer
ports:
- protocol: TCP
port: 8081
targetPort: 8081
nodePort: 30002
为什么我可以通过 http://localhost:8081/(使用端口)而不是 http://localhost:30002(使用 nodePort)访问它?