i have an application that record live traffic and replay them.
https://github.com/buger/goreplay
it is a simple app to use, but when i tried to use it with kubernetes i get a problem with connecting or communicating pods.
i created a pod with two containers, one is goreplay and the other is a simple python webserver. in this pod the goreplay will track the traffic coming from outside to the python server and will forward it to another python server which is in another pod.
here is the first deployment file :
apiVersion: apps/v1
kind: Deployment
metadata:
name: goreplay-deployment
labels:
app: goreplay-app
spec:
replicas: 1
selector:
matchLabels:
app: goreplay-app
template:
metadata:
labels:
app: goreplay-app
spec:
containers:
- name: goreplay
image: feiznouri/goreplay:2.0
args:
- --input-raw
- :3000
- --output-http="http://service-server.default:3200"
volumeMounts:
- name: data
mountPath: /var/lib/goreplay
- name: myserver
image: feiznouri/python-server:1.1
args:
- "3000"
ports:
- name: server-port
containerPort: 3000
volumes:
- name: data
persistentVolumeClaim:
claimName: goreplay-claim
in the args section of the goreplay container i put the parametre , the output is one of them but i'm not sure what adress to put.
here is the service for the first deployment :
apiVersion: v1
kind: Service
metadata:
name: service-goreplay
spec:
selector:
app: goreplay-app
ports:
- port: 31001
nodePort: 31001
targetPort: server-port
protocol: TCP
type: NodePort
and here is the second deploment which has only the second server :
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-deployment
labels:
app: server-app
spec:
replicas: 1
selector:
matchLabels:
app: server-app
template:
metadata:
labels:
app: server-app
spec:
containers:
- name: myserver
image: feiznouri/python-server:1.1
args:
- "3001"
ports:
- name: server-port
containerPort: 3001
and here is it's service :
apiVersion: v1
kind: Service
metadata:
name: service-server
spec:
selector:
app: server-app
ports:
- port: 3200
targetPort: server-port
protocol: TCP
the problem is that , this way , i'm not getting the traffic to the second server, i am sending request from outside to the first server and i see the traffic coming to the first one , but there is nothing in the second server
What is the correct adress to put in the output parametre of the second server for this to work.
I reproduced your issue and it seems the only thing you need to fix is the args
field.
Add "
"
to every arguments, it should look like this:<br>
Note: http://service-server.default:3200
isn't enclosed in additional double quotation mark.
args:
- "--input-raw"
- ":3000"
- "--output-http=http://service-server.default:3200"
More information on defining a command and arguments can be found in the documentation.