<p>I am using Ambassador to manage my Kubernetes services.  My Kubernetes services consist of a few web servers and a few postgres.  I followed the instructions <a href="https://www.getambassador.io/user-guide/getting-started/" rel="nofollow noreferrer">here</a>to establish routes to my web servers.  Here is an example:</p>

<pre><code>  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      kind:  Mapping
      name:  somewebservice
      prefix: /somewebservice
      service: somewebservice:80
</code></pre>

<p>This works perfectly for my webserver.  I can do <code>curl localhost/somewebservice</code> and I get the expected response.</p>

<p>I have set up the same annotation in my postgres container, but I cannot do a psql.</p>

<pre><code>  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      kind:  Mapping
      name:  atlas
      prefix: /somepostgres
      service: somepostgres:5432
</code></pre>

<p>I see the following:</p>

<pre><code>$ psql -h 'localhost/somepostgres' -p 5432
psql: could not translate host name "localhost/somepostgres" to address: nodename nor servname provided, or not known
</code></pre>

<p>My goal is to have Ambassador accept both HTTP/HTTPS &amp; postgres requests.
  Thanks for your time.</p>

<p>Postgres is a TCP service (Layer 4) and not an HTTP(s) service (Layer 7). <a href="https://www.getambassador.io/reference/mappings#services" rel="nofollow noreferrer">It doesn't look like Ambassador supports TCP only services</a>, even though the <a href="https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/tcp_proxy" rel="nofollow noreferrer">Envoy proxy supports it</a>. So you'll have to do with a regular Kubernetes TCP service, something like this:</p>

<pre><code>kind: Service
apiVersion: v1
metadata:
  name: postgres-svc
spec:
  selector:
    app: postgres
  ports:
  - protocol: TCP
    port: 5432
</code></pre>
