<p>Sometimes a pod should take some times to "warmup"(like load some data to cache). At that time it should not be exposed.</p>

<p>How to prevent a pod to be added to a kube-service unitl initialization complete?</p>

<p>You should use health checks. More specifically in Kubernetes, you need a <code>ReadinessProbe</code></p>

<blockquote>
  <p>ReadinessProbe: indicates whether the container is ready to service requests. If the ReadinessProbe fails, the endpoints controller will remove the pod’s IP address from the endpoints of all services that match the pod. The default state of Readiness before the initial delay is Failure. The state of Readiness for a container when no probe is provided is assumed to be Success.</p>
</blockquote>

<p>Also, difference from <code>LivenessProbe</code>:</p>

<blockquote>
  <p>If you’d like to start sending traffic to a pod only when a probe succeeds, specify a ReadinessProbe. In this case, the ReadinessProbe may be the same as the LivenessProbe, but the existence of the ReadinessProbe in the spec means that the pod will start without receiving any traffic and only start receiving traffic once the probe starts succeeding.</p>
</blockquote>

<p><a href="http://kubernetes.io/docs/user-guide/pod-states/" rel="nofollow noreferrer">http://kubernetes.io/docs/user-guide/pod-states/</a></p>
