Asking for help? Comment out what you need so we can get more information to help you!
We have a setup where we want to run 3 replicas of our Image. Each replica will be run in independent node and corresponding pods inside it.
So to summarize we will have 3 nodes in 3 separate JVMs and 3 corresponding pods.
Please answer,
Can the Node IP and hostname be same as machine IP and hostname?
Can the same Machine IP and hostname be made POD IP and hostname?
Can we fix POD IP and hostName always?
Cluster information:
Kubernetes version:
Cloud being used: (put bare-metal if not on a public cloud)
Installation method:
Host OS:
CNI and version:
CRI and version:
You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.
You can use hosrnetwork in the pods ( deployment or sts) yaml configuration …though I would strongly advise you not to do so and find a different solution.
To keep pod hostname fixed you can use sts (statefulset) along with a headless service which will result in pods with static hostnames at all times
If you could provide some more details and what you are trying to achieve maybe there is a more elegant solution .
@Theog75 , Our setup is like this, we have 3 different JVMs, where each JVM will have a single node and a single pod associated with it(3 replicas in 3 individual nodes and JVM). So when we have a fixed JVM/System name, we were thinking of fixing the IP:PORT for each pod so that communication to respective pods would be easier.
There are cases where our third party apps needs to communicate with each pod individually, so we are looking for a solution where we can either fix POD IP:PORT or node IP:PORT. Please advise
a statefulset deployment where pod named are kept the same between deployments (for example if the statefuleset is called jvm the pods it deploys will be called jvm-0,jvm-1 and jvm-2).
use a service for normal communication (LB communication meaning communicatoin sent to this service would be sent to one of the jvm pods randomly - you can use sticky sessions to keep communication with a specific pod per session).
I would create an additional headless service (see headless service) to send communication directly to a specific pod - the way it would work is by using the pod name and the service name to access a specific pod i.e. jvm.jvm-1:8080 as a hostname.(replace 8080 with your port).
in order to make sure pods do not deploy on the same node I would use podAntiAffinity along with requiredDuringSchedulingIgnoredDuringExecution in the affinity configuration (see advance scheduling)
Having the statefulset and headless service also may not solve this issue as the name of the POD on a given node is still dynamic in nature correct jvm**-0**.
In our application we have the EHCache replication , where if any of the data in the cache on one POD is modified , we need to replicate data on rest of the two PODs as well.
In normal cases without Kubernetes , on each node , we do configure the HOST IPs and PORT of rest of the two HOST in EHCache configurations file so that we could connect to those HOST and replicate the cache using RMI protocol.
In case of Kubernetes , I guess these names can’t be pre-determined and subjected to change correct so cache replication may not work.
I hope , the problem statement is clear. Let me know if you need any more information.