Using:
kubectl expose deployment <Name-Of-Servce> --name=loadbalancer --port=8080 --target-port=8080 --type=LoadBalancer
The kubectl get services
is showing pending:
loadbalancer LoadBalancer <x.x.x.x> <pending> 8080:32670/TCP 2m
Before Docker surported Kubernetes, I could use MiniKube and Helm:
helm install stable/jenkins
kubectl get services // To get the service name
minikube service original-llama-jenkins // << The service name
Now that we have Docker for Mac(Edge) supporting Kubernetes, how do you add an EXTERNAL-IP
?
Kubernetes is available in Docker for Mac for 18.06 Stable or higher and includes a Kubernetes server and client, as well as integration with the Docker executable. The Kubernetes server runs locally within your Docker instance and it is similar to the Docker on Windows solution.
How to deploy NGINX Ingress Controller on Kubernetes using kubectlPrerequisitesStep 1 - Install NGINX Ingress ControllerStep 2 - Exposing the NGINX Ingress ControllerLoad BalancerNodePortStep 3 - Validate the NGINX Ingress ControllerStep 4 - Exposing Services using NGINX Ingress ControllerConclusionInterested in more ...
Both type LoadBalancer and NodePort work on Docker for Mac Kubernetes. It's a lovely bit of magic, actually. Just hit localhost:[port]. For NodePort, a port is automatically assigned unless specified in the service definition. For type LoadBalancer, it is also specified in the service definition. Note that in using LoadBalancer, the status from kubectl
will be shown as <pending>
for EXTERNAL-IP but it does work.
This guy notes that it's exposed through vpnkit though I think another source would be helpful:
https://github.com/jnewland/local-dev-with-docker-for-mac-kubernetes
Edit: updated because Kubernetes is now available in stable versions of DfM.
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