I have a Kubernetes cluster (Vagrant & CoreOS) running with 2 workers locally.
I can deploy a Docker Image on this Kubernetes cluster with:
$ kubectl run api4docker --image=myhost:5000/api4docker:latest --replicas=2 --port=8080 —env="SPRING_PROFILES_ACTIVE=production"
When I get the pods, I see them running fine
I expose this deployment as service with:
$ kubectl expose deployment api4docker --port=8080 --type=LoadBalancer
Here is more information about exposed service.
After that, I can access this service only from the worker nodes. How can I make my service accessible from outside?
What is the suggested practice for exposing service to the public?
Thank you,
Turgos
$ kubectl expose deployment api4docker --type=NodePort
$ kubectl describe services api4docker
Name: api4docker
Namespace: default
Labels: run=api4docker
Selector: run=api4docker
Type: NodePort
IP: 10.3.0.88
Port: <unset> 8080/TCP
NodePort: <unset> 31713/TCP
$ curl http://10.3.0.88:31713
curl: (7) Failed to connect to 10.3.0.88 port 31713: Operation timed out
By the way, I can ping the 10.3.0.88 and get reply