question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not able to get TCPMapping working

See original GitHub issue

Describe the bug Not able to access TCP Mapping upstream via ambassador API Gateway IP

To Reproduce Create a service with TCPMapping and try to access the upstream via exposed port in the mapping Ex

---
apiVersion: v1
kind: Service
metadata:
  name: tcp-server
  namespace: default
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v1
      kind: TCPMapping
      name: tcp_mapping
      port: 2222
      service: tcp-server:8000
spec:
  selector:
    app: tcp-server
  ports:
  - port: 8000
    name: tcp-server-port
    targetPort: tcp-port

My TCP server is running in 8000 port and I have created a TCP mapping to access via ambassador IP via port 2222. I am able to check/test via its cluster ip and port and its working fine.
I just did telnet <clusterip> 8000 But with <ambassador ip> 2222 ,I am not able to access

In ambassador logs it shows

[2019-04-23 11:05:31.661][85][info][upstream] [source/common/upstream/cluster_manager_impl.cc:483] add/update cluster cluster_tcp_server_8000 starting warming
2019/04/23 11:05:31 SYNC: read |0: file already closed
2019/04/23 11:05:31 SYNC: read |0: file already closed
[2019-04-23 11:05:31.738][85][info][upstream] [source/server/lds_api.cc:74] lds: add/update listener 'listener-0.0.0.0-2222'
[2019-04-23 11:05:31.743][85][info][upstream] [source/common/upstream/cluster_manager_impl.cc:496] warming cluster cluster_tcp_server_8000 complete

I logged in into ambassador pod as well and I can see 2222 port in listening state …

ambassador $ netstat -anp | grep 2222
tcp        0      0 0.0.0.0:2222            0.0.0.0:*               LISTEN      85/envoy

Expected behavior I should be able to access via ambassador ip and port mapped For example telnet ambassadorip 2222

Versions (please complete the following information):

  • Ambassador: 0.53.1
  • Kubernetes environment: Bare Metal
  • Version : v1.13.5

Please find attached my code with this as well Zip contains

  1. Docker project in tcp_server folder
  2. Kubernetes yaml for deploying tcp_server with ambassador TCP Mapping annotation
  3. Python Client code to access/talk to tcp server

Step to Build

  1. Go into tcp_server folder . Do docker build -t tcp_server .
  2. Deploy tcp_server.yaml file in kubernetes cluster
  3. Try to do telnet to tcp_server cluster ip and port 8000 , this will work But with ambassador ip and port 2222 , it doesn’t work.

tcp_mapping.zip

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
popaaaandreicommented, May 1, 2019

You are referring to only to the configuration of Ambassador itself. Basically you can configure anything you want but unless you open those ports on the LoadBalancer it will be useless. Ambassador k8s service (usually type: LoadBalancer) exposes port 80 and 443 by default. If you need port 2222, you have to add port 2222 explicitly.

Check out my configuration, I wanted port 1883 (MQTT):

apiVersion: v1
kind: Service
metadata:
   name: ambassador

.....

ports:
  - name: http
    nodePort: 31403
    port: 80
    protocol: TCP
    targetPort: 8080
  - name: https
    nodePort: 31873
    port: 443
    protocol: TCP
    targetPort: 8443
  - name: mqtt
    nodePort: 31863
    port: 1883
    protocol: TCP
    targetPort: 1883
1reaction
richarddlicommented, May 1, 2019

Not a bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to get TCPMapping working · Issue #1457 - GitHub
My TCP server is running in 8000 port and I have created a TCP mapping to access via ambassador IP via port 2222....
Read more >
TCPMapping resources | Ambassador
Like all native Emissary-ingress resources, TCPMappings have an ambassador_id field ... If the Listener does not terminate TLS (controlled by Listener.spec.
Read more >
datawire/ambassador - Gitter
<sonyjop> I have a kubernetes master/node setup in cent os. After setting up ambassador as an API gateway, I have tried a sample...
Read more >
Add AOL Configuration - Practically Networked
They do not apply if you are using ICS, Sygate, or any other NAT based sharing ... Make the following entries in the...
Read more >
Proxy Protocol not working with L4 -> Ambassador TLS ...
Proxy Protocol not working with L4 -> Ambassador TLS termination ... Go to https://{ambassador-host}/edge_stack/admin/#dashboard to register ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found