I think I have interesting use case so I would like to hear advices of the people with more knowledge.
I have my App ("ads") which works in Kubernetes without any issue. It runs on port 9000.
It has args which have its instance name (serverName) and in the list of servers it has reference to all other servers as well (servers) in order to run those servers in so called companion mode needed for performance reasons.
Please have in mind that this is NOT a WEB SERVER and simple replicas will NOT work for what we need to achieve and that is to have multiple ADS servers working in so call companion mode in which the primary server sends the cached data to another server so that server also has the recent data and can take over in case of failure.
Extricate from the first ADS YAML file:
-in serverName we specify the name of the server instance
-in servers arg we specify regular ADS server address with its port.
args:
....
"-serverName", "ads"
"-servers", "{ { ads , ads-test:9000 }, { ads2 , ads-test2:9000}"]
ports:
- containerPort: 9000
..................
kind: Service
metadata:
name: ads-test
spec:
type: ClusterIP
ports:
- protocol: TCP
port: 9000
selector:
app: ads-test
So in the list of arguments we specify the Service through which we should access that ADS instance using the TCP connection (not HTTP connection) with ads-test:9000. Since this is containerized app I did not know what else I could specify as server address except of "ServiceName:port", because development of this app did not suppose containerized app.
So the second one YAML should be different only with serverName info.
And I added additional Service ads-test2
args:
....
"-serverName", "ads2"
"-servers", "{ { ads , ads-test:9000 }, { ads2 , ads-test2:9000}"]
ports:
- containerPort: 9000
..................
kind: Service
metadata:
name: ads-test2
spec:
type: ClusterIP
ports:
- protocol: TCP
port: 9000
selector:
app: ads-test2
Since this is actually the same App, but only with one argument different in its configuration (serverName) I was wondering if there is some way how I could simplify this and use single Service in order to access both ADS servers but to have this configuration within the server argument which actually activates this kind of companion mode which is needed for performance reasons for usage of different servers but to have information up to date on both servers.
Thank you