How to select a specific pod for a service in Kubernetes

The feature you're looking for is called StatefulSets, which just launched to beta with Kubernetes 1.5 (note that it was previously available in alpha under a different name, PetSets).

In a StatefulSet, each replica has a unique name that is persisted across restarts. In your example, these would be instance-1, instance-2, instance-3. Since the instance names are persisted (even if the pod is recreated on another node), you don't need a service-per-instance.

The documentation has more details:

  • Using StatefulSets
  • Scaling a StatefulSet
  • Deleting a StatefulSet
  • Debugging a StatefulSet