<p>I have create a 2 services in Kubernetes with 2 internal loadbalancer in GCP. Things are working fine. </p>

<p>How can I point the 2 services to the same loadbalancer?</p>

<p>I have used the below yml file, the service is not working.</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: sample-app
  labels:
    name: sample-app
    app: sample-app
spec:
  ports:
  - name: sampleapp
    protocol: TCP
    port: 8080
    targetPort: 8080
  selector:
    name: sample-app
    app: sample-app
  type: "LoadBalancer"
  loadBalancerIP: XX.XX.XX.XX
</code></pre>

<p>The loadBalancerIP, expects the actual loadbalancer IP. </p>

<p>Error creating load balancer (will retry): failed to ensure load balancer for service default/sampleapp: requested ip "XX.XX.XX.XX" is neither static nor assigned to the LB</p>

<p>I was able to create the NGINX ingress controller by Kubernetes using the below blogs.</p>

<p><a href="http://rahmonov.me/posts/nginx-ingress-controller/" rel="nofollow noreferrer">http://rahmonov.me/posts/nginx-ingress-controller/</a>?
<a href="https://imti.co/web-cluster-ingress/" rel="nofollow noreferrer">https://imti.co/web-cluster-ingress/</a></p>

<p>And created an Ingress to point to my endpoints.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
  ingress.kubernetes.io/rewrite-target: /
  name: cobalt-app
  namespace: default
  spec:
    rules:
    - http:
      paths:
    - backend:
      serviceName: sampleapp
      servicePort: 8080
      path: /greeting
   - backend:
      serviceName: echoserver
      servicePort: 8080
    path: /echo
</code></pre>
