How to assign static IP address or HostName to node and POD

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,

  1. Can the Node IP and hostname be same as machine IP and hostname?
  2. Can the same Machine IP and hostname be made POD IP and hostname?
  3. 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.

I hope I got the question right…

  1. Machine IP and node IP should be the same …
  2. 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.
  3. 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 .