Glad you got it working.

Is your goal to run specific services locally on developers laptops, but also 
share them so other developers can access them?

Vagrant has some facilities for attaching your VMs to a “public” network. 
You’ll have to modify the Vagrantfile with those options:

https://www.vagrantup.com/docs/networking/public_network.html 
<https://www.vagrantup.com/docs/networking/public_network.html>

From the Kubernetes side, using NodePorts for only the services that will be 
“public” is a good idea, with the rest remaining internal to the cluster.

Another method would be to host your yaml definitions in a single repo, which 
would be a single source for all of your developers to run a copy of other 
teams services locally. This would prevent you from having to do this more 
complex networking.

An example workflow might be to have a single file that contains the latest 
service, deployment, sample secrets, etc. Someone wanting to run a dev install 
of this API would just have to do `kubectl create -f api-stack.yml` and access 
the API over the node port. Keep in mind that all users will need to be able to 
pull the containers required, or you can include a pull secret as part of your 
file.

 - Rob

> On Jun 27, 2016, at 10:15 AM, Gokhan Sevik <[email protected]> wrote:
> 
> Thank you Brandon and Rob.
> 
> Yes, After trying with 172.17.4.x address, it all worked fine. 
> 
> We are planning to use Kubernetes on Local Vagrant&CoreOS environment. Do you 
> have any recommendation/best practices for how to expose our APIs to users on 
> our intranet?
> 
> Thank you again,
> Turgos.
> 
> On Fri, Jun 24, 2016 at 8:30 PM, Brandon Philips <[email protected] 
> <mailto:[email protected]>> wrote:
> Right, the IP listed is the IP of the pod. Not the IP of the virtual machine. 
> You need to hit the 172.17.4.x address as rob mentions.
> 
> On Fri, Jun 24, 2016 at 12:04 PM Rob Szumski <[email protected] 
> <mailto:[email protected]>> wrote:
> Are you using the coreos-kubernetes Vagrant boxes 
> <https://coreos.com/kubernetes/docs/latest/kubernetes-on-vagrant.html>? Those 
> should be set up with 172.17.4.x IP addresses, which is the node’s IP 
> address. That box should have the networking set up such that you can access 
> it from your laptop/host machine.
> 
>> On Jun 24, 2016, at 2:24 PM, Gokhan Sevik <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> I still cannot access after setting the type NodePort.
>> 
>> $ 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
>> 
>> Endpoints:   10.2.46.2:8080 <http://10.2.46.2:8080/>,10.2.97.3:8080 
>> <http://10.2.97.3:8080/>
>> Session Affinity:    None
>> 
>> No events.
>> 
>> 
>> $ curl http://10.3.0.88:31713 <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 
>> 
>> 
>> 
>> 
>> On Fri, Jun 24, 2016 at 1:56 PM, Rob Szumski <[email protected] 
>> <mailto:[email protected]>> wrote:
>> Nope, it only works for VMs set up on the cloud. The NodePort should work 
>> for you though.
>> 
>>> On Jun 24, 2016, at 1:53 PM, Gokhan Sevik <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> Hi Rob, 
>>> Does cloud credentials set up required/works for local set up? Is there any 
>>> link how to set it for my Kubernetes with local Vagrant&CoreOS.
>>> 
>>> Thank you, Turgos,
>>> 
>>> On Fri, Jun 24, 2016 at 12:59 PM, Rob Szumski <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> It doesn’t look like you have cloud credentials set up to use 
>>> Type=LoadBalancer. If it had worked, you’d see a “loadBalancerIP” field.
>>> 
>>> You could also expose this service as a NodePort, which is just a port in 
>>> the 32xxx range that works on every machine in the cluster. You can then 
>>> hook this up to a load balancer yourself, or just use the port directly. I 
>>> find that NodePorts are great for testing since they work in all 
>>> environment pretty easily.
>>> 
>>>  - Rob
>>> 
>>>> On Jun 24, 2016, at 11:24 AM, Turgos <[email protected] 
>>>> <mailto:[email protected]>> wrote:
>>>> 
>>>> $ kubectl get svc api4docker
>>>> NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
>>>> api4docker   10.3.0.95                                 8090/TCP   20m
>>> 
>>> 
>> 
>> 
> 
> 

Reply via email to