<p>I want to host a website (simple nginx+php-fpm) on Google Container Engine. I built a replication controller that controls the nginx and php-fpm pod. I also built a service that can expose the site.</p>

<p>How do I link my service to a public (and reserved) IP Address so that the webserver sees the client IP addresses? </p>

<p>I tried creating an ingress. It provides the client IP through an extra http header. Unfortunately ingress does not support reserved IPs yet:</p>

<pre><code>kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
  - host: example.org
    http:
      paths:
      - backend:
          serviceName: example-web
         servicePort: 80
        path: /
</code></pre>

<p>I also tried creating a service with a reserved IP. This gives me a public IP address but I think the client IP is lost:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: 'example-web'
spec:
  selector:
    app: example-web
  ports:
    - port: 80
      targetPort: 80
  loadBalancerIP: "10.10.10.10"
  type: LoadBalancer
</code></pre>

<p>I would setup the HTTP Loadbalancer manually, but I didn't find a way to configure a cluster IP as a backend for the loadbalancer.</p>

<p>This seems like a very basic use case to me and stands in the way of using container engine in production. What am I missing? Where am I wrong?</p>

<p>As you are running in google-container-engine you could set up a <a href="https://cloud.google.com/compute/docs/load-balancing/http/" rel="nofollow">Compute Engine HTTP Load Balancer</a> for your static IP. The <a href="https://cloud.google.com/compute/docs/load-balancing/http/target-proxies" rel="nofollow">Target proxy</a> will add <code>X-Forwarded-</code> headers for you.</p>

<p>Set up your kubernetes service with type <a href="http://kubernetes.io/v1.1/docs/user-guide/services.html#type-nodeport" rel="nofollow">NodePort</a> and add a <code>nodePort</code> field. This way <code>nodePort</code> is accessible via kubernetes-proxy on every nodes IP address regardless of where the pod is running:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
 name: 'example-web'
spec:
 selector:
   app: example-web
 ports:
   - nodePort: 30080
     port: 80
     targetPort: 80
 type: NodePort
</code></pre>

<p>Create a <a href="https://cloud.google.com/compute/docs/load-balancing/http/backend-service" rel="nofollow">backend service</a> with HTTP health check on port 30080 for your instance group (nodes).</p>
