<p>I am trying to setup a simple knock-knock server in my cluster and currently it works internally but I cannot get it to connect from a remote connection. For reference this is the server I am trying to use just for testing purposes.  <a href="https://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html" rel="nofollow noreferrer">https://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html</a></p>

<p>Currently I am using NGINX Ingress Controller.</p>

<pre><code>NAME              TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
knock-server      ClusterIP      10.104.42.238    &lt;none&gt;        9000/TCP         25m


testing@host:~$ java KnockKnockClient 10.104.42.238 9000
Server: Knock! Knock!
</code></pre>

<p>I have other Ingress's that work perfectly but those are for website related deployments and not for an internal server like this. I have tried 2 different Ingress's but neither work.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: knockknock-ingress
spec:
  rules:
  - host: domain.com
    http:
      paths:
      - backend:
          serviceName: knock-server
          servicePort: 9000
</code></pre>

<p>And</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: knock-ingress
spec:
   backend:
    serviceName: knock-server
    servicePort: 9000
</code></pre>

<p>I am not sure what I am doing wrong on this one, and any and all help is appreciated. </p>

Erwin
<p>You can use ingress controller to expose tcp service.</p>

<ol>
<li>change the ingress controller to include the following parameter:</li>
</ol>

<blockquote>
<pre><code>--tcp-services-configmap tcp-configmap-example
</code></pre>
  
  <p>Name of the ConfigMap containing the definition of the TCP services to expose. The key in the map indicates the external port to be used. The value is a reference to a Service in the form "namespace/name:port", where "port" can either be a port number or name. TCP ports 80 and 443 are reserved by the controller for servicing HTTP traffic.</p>
</blockquote>

<ol start="2">
<li>Create the configmap for tcp service:</li>
</ol>

<blockquote>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: tcp-configmap-example
data:
  9000: "default/knock-server:9000"
</code></pre>
</blockquote>
