<p>I'm experimenting with SMTP (mailoney) and SSH honeypots in a Kubernetes cluster to be exposed to the big bad WWW. I cant seem to figure out how to get it working since I'm only beginning to understand Kubernetes just recently. </p>

<p>I've got some config now, for example my mailoney.yaml:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: mailoney
spec:
  selector:
    matchLabels:
      app: mailoney
  template:
    metadata:
      labels:
        app: mailoney
    spec:
      containers:
      - name: mailoney
        image: dtagdevsec/mailoney:2006
        ports:
        - containerPort: 25
</code></pre>

<p>and the service config:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: ingress-mailoney
  labels:
    name: mailoney
spec:
  type: LoadBalancer
  ports:
    - name: smtp
      port: 25
      targetPort: 25
      protocol: TCP
  selector:
    name: mailoney
</code></pre>

<p>But when the loadbalancer is configured, it exposes the services on port >30000, which I know is default behaviour for Kubernetes. But how do I exactly configure the loadbalancer to allow connections on port 25 and 22 respectively and actually letting connections through to the honeypots?</p>

<p>am I overlooking something really obvious?</p>

<p>Any help is appreciated. </p>

chr0nk
<p>As @coderanger mentioned, your cloud provider will take care of everything and make the original port available.
Reading your service manifest I could notice that your selector is wrong, it should point to <code>app: mailoney</code> instead of <code>name:</code>. I tested it and it's working with the correct selector.</p>
<p>Here is how your manifest should look like:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: ingress-mailoney
  labels:
    name: mailoney
spec:
  type: LoadBalancer
  ports:
    - name: smtp
      port: 25
      targetPort: 25
      protocol: TCP
  selector:
    app: mailoney
</code></pre>
<p>After changing it to <code>app: mailoney</code> I have the following results:</p>
<pre><code>$ kubectl get service ingress-mailoney -o wide
NAME               TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)        AGE   SELECTOR
ingress-mailoney   LoadBalancer   10.31.250.51   104.197.119.16   25:30601/TCP   44m   app=mailoney
</code></pre>
<pre><code>$ telnet 104.197.119.16 25
Trying 104.197.119.16...
Connected to 104.197.119.16.
Escape character is '^]'.
220 mailrelay.local ESMTP Exim 4.81 #1 Thu, 29 Jul 2010 05:13:48 -0700
</code></pre>
<p>As you can see, it's working as designed.</p>
