Reputation: 555
I am fairly new to Kubernetes. I am trying to figure out the best structure for a pod that requires configuration depending upon which pod requests its services.
So for example. Data Stream port might be 8080, this is a stream of data of unknown size. Data is processes as it is received. So I can't really use a REST API with a payload as the payload is a stream which could be days long.
The issue is that I might have 10+ copies of this service, and they need to be configured dynamically upon a client pod connecting to that service. I would prefer to use a separate port like 9000 to connect to the pod with an XML or INI file type of configuration.
My concern is the following. Since there is 10 copies and the same pod is making 2 unique requests to a services, are they guaranteed to connect to the same service pod or could they be 2 different ones? Ultimately, I would want to select a service pod (orchestrator can select, but it be a known IP address now), send a configuration file to 9000, then connect to port 8080 with a data stream for the service to be properly completed.
Upvotes: 0
Views: 335
Reputation: 1543
Since you are trying to open multiple ports for the same service on the same pod, you can assign each port a different name. I’m providing you with a sample yaml file in which a service is communicating outside using both port 80 and port 443.
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: MyApp
ports:
- name: http
protocol: TCP
port: 80
targetPort: 9376
- name: https
protocol: TCP
port: 443
targetPort: 9377
For more information and explanation you can refer to this link from where the above yaml example is provided.
Update:
Upvotes: 1