How to use ClusterIP service

Hi
Can some one help me with sample YAML files for Frontend POD - Service and Backend POD

As I understand the labels are added in the service.yaml file to connect the service to the POD - Any traffic going to that service will redirect to the target port on the POD.

Now the question is how do we connect the POD to the service as we do not add any selectors in the POD.YAML to connect with a specific service.

Please help

The service selector says which labels it is looking for (on pods). You still have to put those labels on your pods.

Dear Tim
Thanks for your reply.

Yes, for a service to select the right POD labels are needed to be added on both Service and POD - I understand that. My question is communication from Pod to a Service …

If a Pod-A wants to communicate with Pod-B via a service. Pod-A will send its traffic to the service(first) which will in-turn route it to Pod-B. For this to happen, in the YAML file of Pod-A, do I need to add any selector for choosing the service, Or just the ServiceName/IPaddr-Port of the service is good enough ?

I hope I was able to articulate my questions properly …

Thanks in advance
Saleem

You just need the services name or IP address. And port number obviously.