Not able to get TCPMapping working
See original GitHub issueDescribe 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
- Docker project in tcp_server folder
- Kubernetes yaml for deploying tcp_server with ambassador TCP Mapping annotation
- Python Client code to access/talk to tcp server
Step to Build
- Go into tcp_server folder . Do docker build -t tcp_server .
- Deploy tcp_server.yaml file in kubernetes cluster
- 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (2 by maintainers)
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):
Not a bug.