<p>I have created the replication controller in Kubernetes with the following configuration:</p>

<pre><code>{
   "kind":"ReplicationController",
   "apiVersion":"v1",
   "metadata":{
      "name":"guestbook",
      "labels":{
         "app":"guestbook"
      }
   },
   "spec":{
      "replicas":1,
      "selector":{
         "app":"guestbook"
      },
      "template":{
         "metadata":{
            "labels":{
               "app":"guestbook"
            }
         },
         "spec":{
            "containers":[
               {
                  "name":"guestbook",
                  "image":"username/fsharp-microservice:v1",
                  "ports":[
                     {
                        "name":"http-server",
                        "containerPort":3000
                     }
                  ],
                  "command": ["fsharpi", "/home/SuaveServer.fsx"]
               }
            ]
         }
      }
   }
}
</code></pre>

<p>The code of the service that is running on the port 3000 is basically this:</p>

<pre><code>#r "Suave.dll"
#r "Mono.Posix.dll"
open Suave
open Suave.Http
open Suave.Successful
open System
open System.Net
open System.Threading
open System.Diagnostics
open Mono.Unix
open Mono.Unix.Native

let app = OK "PONG"

let port = 3000us
let config =
  { defaultConfig with
     bindings = [ HttpBinding.mk HTTP IPAddress.Loopback port ]
     bufferSize = 8192
     maxOps = 10000
  }

open System.Text.RegularExpressions

let cts = new CancellationTokenSource()
let listening, server = startWebServerAsync config app
Async.Start(server, cts.Token)

Console.WriteLine("Server should be started at this point")
Console.ReadLine()
</code></pre>

<p>After I created the service I can see the pod:</p>

<pre><code>$kubectl create -f guestbook.json
replicationcontroller "guestbook" created
$ kubectl get pods
NAME                   READY     STATUS             RESTARTS   AGE
guestbook-0b9py        1/1       Running            0          32m
</code></pre>

<p>I want to access my web service and create the service with type=LoadBalancer that will expose the 3000 port with the following configuration:</p>

<pre><code>{
   "kind":"Service",
   "apiVersion":"v1",
   "metadata":{
      "name":"guestbook",
      "labels":{
         "app":"guestbook"
      }
   },
   "spec":{
      "ports": [
         {
           "port":3000,
           "targetPort":"http-server"
         }
      ],
      "selector":{
         "app":"guestbook"
      },
      "type": "LoadBalancer"
   }
}
</code></pre>

<p>Here is the result:</p>

<pre><code>$ kubectl create -f guestbook-service.json
service "guestbook" created
$ kubectl get services
NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
guestbook    10.0.82.40                 3000/TCP   7s
kubernetes   10.0.0.1     &lt;none&gt;        443/TCP    3h
$ kubectl describe services
Name:           guestbook
Namespace:      default
Labels:         app=guestbook
Selector:       app=guestbook
Type:           LoadBalancer
IP:         10.0.82.40
LoadBalancer Ingress:   a43eee4a008cf11e68f210a4fa30c03e-1918213320.us-west-2.elb.amazonaws.com
Port:           &lt;unset&gt; 3000/TCP
NodePort:       &lt;unset&gt; 30877/TCP
Endpoints:      10.244.1.6:3000
Session Affinity:   None
Events:
  FirstSeen LastSeen    Count   From            SubobjectPath   Type        Reason          Message
  --------- --------    -----   ----            -------------   --------    ------          -------
  18s       18s     1   {service-controller }           Normal      CreatingLoadBalancer    Creating load balancer
  17s       17s     1   {service-controller }           Normal      CreatedLoadBalancer Created load balancer


Name:           kubernetes
Namespace:      default
Labels:         component=apiserver,provider=kubernetes
Selector:       &lt;none&gt;
Type:           ClusterIP
IP:         10.0.0.1
Port:           https   443/TCP
Endpoints:      172.20.0.9:443
Session Affinity:   None
No events.
</code></pre>

<p>The "External IP" column is empty</p>

<p>I have tried to access the service using "LoadBalancer Ingress" but DNS name can't be resolved.</p>

<p>If I check in the AWS console - load balancer is created (but in the details panel there is a message "0 of 2 instances in service" because of health-checks).</p>

<p>I have also tried to expose my RC using kubectl expose --type=Load-Balancer, but result is the same.</p>

<p>What is the problem?</p>

<p>I fixed the error. </p>

<p>The thing was in the actual service. It needs to be listening on 0.0.0.0 instead of 127.0.0.1 or localhost. That way it will listen on every available network interface. More details on the difference between 0.0.0.0 and 127.0.0.1: <a href="https://serverfault.com/questions/78048/whats-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1">https://serverfault.com/questions/78048/whats-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1</a></p>
