In minikube I can get a service's url via minikube service kubedemo-service --url
. How do I get the URL for a type: LoadBalancer
service in Docker for Mac or Docker for Windows in Kubernetes mode?
service.yml
is:
apiVersion: v1
kind: Service
metadata:
name: kubedemo-service
spec:
type: LoadBalancer
selector:
app: kubedemo
ports:
- port: 80
targetPort: 80
When I switch to type: NodePort
and run kubectl describe svc/kubedemo-service
I see:
...
Type: NodePort
LoadBalancer Ingress: localhost
...
NodePort: <unset> 31838/TCP
...
and I can browse to http://localhost:31838/
to see the content. Switching to type: LoadBalancer
, I see localhost ingress lines in kubectl describe svc/kubedemo-service
but I get ERR_CONNECTION_REFUSED
browsing to it.
(I'm familiar with http://localhost:8080/api/v1/namespaces/kube-system/services/kubedemo-service/proxy/
though this changes the root directory of the site, breaking css and js references that assume a root directory. I'm also familiar with kubectl port-forward pods/pod-name
though this only connects to pods until k8s 1.10.)
How do I browse to a type: LoadBalancer
service in Docker for Win or Docker for Mac?
LoadBalancer will work on Docker-for-Mac and Docker-for-Windows as long as you're running a recent build. Flip the type back to LoadBalancer
and update. When you check the describe command output look for the Port: <unset> 80/TCP
line. And try hitting http://localhost:80.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With