<p>Given the following ports defined in a <code>docker-compose.yml</code> file, how do I do the equivalent in a kubernetes yml file?</p>

<h3><code>docker-compose.yml</code></h3>

<pre><code>  seq.logging:
    image: datalust/seq
    networks: 
      - backend
    container_name: seq.logging
    environment:
      - ACCEPT_EULA=Y
    ports:
      - "5300:80" # UI
      - "5301:5341" # Data ingest
</code></pre>

<h3><code>kubernetes.yml</code></h3>

<pre><code>---
apiVersion: v1
kind: Pod
metadata:
  name: backend-infrastructure
  labels:
    system: backend
    app: infrastructure
spec:

  containers:

  - name: seq-logging
    image: datalust/seq
#    ports: ?????????????????????????????????????
#    - containerPort: "5300:80" # UI
#    - containerPort: "5301:5341" # Data ingest
    env:
    - name: ACCEPT_EULA
      value: "Y"
</code></pre>

Pure.Krome
<p>You do not expose a port using Pod/deployment yaml. 
Services are the way to do it. Here you can either use multiple services on top of your pod/deployment but this will result in multiple IP addresses. Other way is to name each port and then create a multi port service definition. </p>

<p>In your case it should look somewhat like this (note this is just a quickly written example). <a href="https://kubernetes.io/docs/concepts/services-networking/service/#multi-port-services" rel="nofollow noreferrer">Also</a>  </p>

<blockquote>
  <p>When using multiple ports you must give all of your ports names, so
  that endpoints can be disambiguated.</p>
</blockquote>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: backend-infrastructure
  labels:
    system: backend
    app: infrastructure
spec:
  containers:
  - name: seq-logging
    image: datalust/seq
    ports:
    - containerPort: 80 # UI
      name: ui
    - containerPort: 5341 # Data ingest
      name: data-ingest
    env:
    - name: ACCEPT_EULA
      value: "Y"
---
apiVersion: v1
kind: Service
metadata:
  name: seq-logging-service
spec:
  type: #service type
  ports:
  - name: ui
    port: 5300
    targetPort: 80
  - name: data-ingest
    port: 5301
    targetPort: 5341
</code></pre>

<p>Some more resources:
- Docs about <a href="https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#the-kubernetes-model-for-connecting-containers" rel="nofollow noreferrer">connecting applications with services</a>.
- example <a href="https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/service/networking/nginx-secure-app.yaml" rel="nofollow noreferrer">yaml</a> from the above featuring deployment with multiple port container and corresponding service. </p>

<p>Update:
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/#containerport-v1-core" rel="nofollow noreferrer">containerPort</a></p>

<blockquote>
  <p>List of ports to expose from the container. Exposing a port here gives
  the system additional information about the network connections a
  container uses, but is primarily informational. Not specifying a port
  here DOES NOT prevent that port from being exposed. Any port which is
  listening on the default "0.0.0.0" address inside a container will be
  accessible from the network. Cannot be updated.</p>
</blockquote>
