I have an application with 2 pods, where one pod is ingesting data and other wants to consume it. I am trying with single node Kubernetes setup. Right now:
`in pod1`
- name: ingest_cfg
value: zmq_tcp,0.0.0.0:9000 [where pod1 is publishing on port 9000, even this I want to be dynamically configurable]
`in pod2`
- name: ingest_cfg
value: "zmq_tcp,IPadd:pv" [where IPadd should be Ip address where pod 1 is publishing and pv is port number where pod1 has published]
Now, I need to know how can I configure this in code. I don't want to hard code the IP address & port. Any pointers will be very helpful. I have tried using service name but that points to cluster IP address.
I suggest you're using a Deployment for each of your apps. Create a Service on top of each of the Deployments. And then from the data consumer you can point to the internal dns service provided by kubernetes.
Let's said your service for data ingestion is:
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: ingestion
ports:
- protocol: TCP
port: 80
targetPort: 9090
You can use the dns of myservice.default.svc.cluster.local
.