Reputation: 25984
Update:
Found this, but it that the right way?
I can see that I can do portforward to e node, like:
kubectl port-forward hello-nginx 8080:80
But I want to play and try to scale and access a service. I have started the service:
kubectl expose deployment hello-nginx --type=NodePort
service “hello-nginx” exposed
and then:
kubectl get services
rolling-sponge-hello-world ClusterIP 10.104.12.39 <none> 80/TCP 3d
Then how do you proxy to the kubernetes service?
Note: Running Docker for Mac(Edge).
Upvotes: 7
Views: 15907
Reputation: 3145
it looks like the output of the kubectl get services
doesn't match with the service you have created. The output says "ClusterIP" while you created a "NodePort" service. The NodePort type allows to proxy the service over its node port, which is open on the IP of every node.
You can extract the NodePort also using kubectl describe service hello-nginx
Upvotes: 0
Reputation: 13789
The best approach would be using a Ingress, as you mentioned. That way, you could send requests to your local machine IP and the Ingress controller would send the traffic to the right Pods
.
For that you need to:
Pods
. These rules can redirect traffic to specific Pods
based on the path or the host in the request.This blog post talks specifically about Docker for mac and Ingress.
Upvotes: 7