I have the following scenario –
The position simulator will get its longitude and latitude data based on time from a gps tracker. So this position simulator has a connection to activemq, but to receive the raw data, is it possible to expose another port of this service to receive the live tracking data?
Best Answer
If you want to expose for example you
deployment
on two or more ports you can do it at least two ways.YAML
. This method is well described in Kubernetes documentation.Example:
kubectl expose
.$ kubectl exposed <resource(deployment/Replicaset/etc)> <deployment-name> --port=XXX,XYZ,ABC --target-port=XXX
$ kubectl expose deployment nginx --port=80,8080,6000 --target-port=8080 service/nginx exposed
As mentioned in Kubernetes docs
targetPort
: is the port the container accepts traffic on,port
: is the abstractedService
port, which can be any port other pods use to access the Service