Skip to content

ismavg/go-echo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GO TCP test Sever

A Simple go TCP test echo server. Written to learn and test Kubernetes TCP networking.

Test with Docker

Run the container from a terminal:

docker run --rm -it -e TCP_PORT=2701 ECHO=true -e NODE_NAME="EchoNode" -p 2701:2701 ismavg/go-echo

In another terminal run:

telnet localhost 2701

Test with Kubernetes

cd k8s
kubectl create -f . 

You should now have two TCP echo containers running:

kubectl get pods --selector=app=tcp-echo
NAME                                   READY     STATUS    RESTARTS   AGE
tcp-echo-deployment-777d856787-5fhb4   1/1       Running   0          27s
tcp-echo-deployment-777d856787-rh9tp   1/1       Running   0          27s

You should also have a service that connection port 32701 to the pods:

kubectl get service --selector=app=tcp-echo-service
NAME               TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
tcp-echo-service   NodePort   10.102.207.113   <none>        2701:32701/TCP   35m

Echo some data, replace ANY_NODE_IP with a location of a node:

telnet ANY_NODE_IP 32701

After connecting, type the word hello and hit return:

Trying x.x.x.x...
Connected to node1.example.com.
Escape character is '^]'.
Welcome, you are connected to node node1.example.com.
Running on Pod tcp-echo-deployment-777d856787-rh9tp.
In namespace default.
With IP address 192.168.33.39.
Service default.
hello
hello

Resources

About

TCP echo server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 82.9%
  • Dockerfile 17.1%