问题
According to Traefik's Kubernetes guide, I should use a Service of type NodePort to expose Traefik (YAML file here). However, if I do that, how do I expose one of the IPs from my cluster to the outside world?
At this moment, I have edited the example traefik-deployment.yaml file to be a LoadBalancer instead, and it seems to work just fine with the IP that the load balancer provides. What am I missing?
回答1:
Both are valid approaches. The Kubernetes guide basically makes one proposal to set things up (with somewhat of a focus on the local minikube configuration). If you have found a path that's more convenient for you, by all means feel free to stick to it.
FWIW, one concern I sometimes hear raised is that cloud-based LoadBalancers may become expensive much faster, whereas with a NodePort you have more control over how requests are routed into your cluster (at the price of reduced convenience).
来源:https://stackoverflow.com/questions/48481979/should-i-use-nodeport-in-my-traefik-deployment-on-kubernetes