I've had partial success. The solution to expose the server on a reserved
external IP address assigned to a VM instance is to

1. Create a service of type NodePort and with an externalIP set to my
reserved external IP.
2. Allow inbound tcp traffic by adding a firewall rule [4]

[4] https://console.cloud.google.com/networking/firewalls/


However, this exposes the server on <external IP>:<nodePort>. How can I
expose it on <external IP>:80 ?


On Mon, Nov 21, 2016 at 11:35 PM, Wiktor Tomczak <wiktor.tomc...@gmail.com>
wrote:

>
> Hello,
>
> I'd like to run two different containers, each with a different
> executable, on the same specific external IP address in Google Container
> Engine (GKE). One executable is a web server and the other is a web client.
> Requests from the client should originate from the same IP that the server
> listens on.
>
> So far I've been able to get the client executable to run on an external
> IP address that I had reserved via Networking > External IP addresses in
> the cloud console [1]. The address is assigned to my only VM instance, so
> IIUC all containers running there use this address for their outgoing IP
> traffic. I can confirm the external IP address eg. by attaching to a
> running container [2] and fetching checkip.dyndns.org from there [3].
>
> OTOH, I haven't been able to expose the server executable on the same IP
> address. I tried both .yaml service configuration and kubectl expose but
> can't get either to work. What should be the value of my service's
> spec.type? If I set type = LoadBalancer and LoadBalancerIP = <my external
> IP above>, load balancer creation fails because the IP is reported as
> already used. If I set type = NodePort, the service gets created, but
> requests to <my external IP>:8080 aren't forwarded to the server executable
> (configured to listen on port 8080).
>
> I'd appreciate any help.
>
> Wiktor
>
> [1] https://console.cloud.google.com/networking/addresses/list
> [2] kubectl run -ti <pod name> -- /bin/bash
> [3] curl checkip.dyndns.org
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to