** disclaimer: I am very shallow in infra topic, but hope my explanation of the case is understandable. Sorry for a possible inaccuracy in terminology.
I have an application working in k8s which is represented by a pod (Pod#1) with a single container (main-container). Also there is k8s-service created inside that pod. In the “main-container” there is working app and a working service (not k8s-service) on localhost:8082 (yellow block on the picture).
During the run time, the app from Pod#1 “main-container” creates k8s-job which is represented by another pod (Pod#2) with another container (job-container).
Here the problem: Pod#2 job-container has a need to communicate with a working service (not k8s-service) which is running in main-container (on port 8082).
I know that this communication can be established through the service (like ServiceName:Port).
But are there any other options to establish this connection? Is it possible for main-container and job-container have a single option for communication with service (like https://localhost:8082 which won't definitely work for job-container)
Relaying on the discussion in comments I have established the communication via Service by replacing localhost:port call to service-name:call in job-container. Thank you all!