<p>For for a StateFul set, I can access its pods via a headless service internally.</p>

<p>I think, it would make sense, to have an easy way to expose also single pods externally (since the pods usually have a state and therefore loadbalancing over them makes no sense). </p>

<p>So far, I found no straight forward way to do that.
Even doing <code>kubectl expose pod pod-1 --type NodePort</code> gives me a service which balances over all pods.
Is there a reason why this is like this or is there a nice way to access single pods.</p>

<p>You can expose a specific <code>Pod</code> in a <code>StatefulSet</code> externally by matching on the <code>statefulset.kubernetes.io/pod-name</code> label.</p>
<p>For example, if your <code>StatefulSet</code> is named <code>app</code> and you want to expose port 80 from the first <code>Pod</code> as a <code>Service</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: app-0
spec:
  type: LoadBalancer
  selector:
    statefulset.kubernetes.io/pod-name: app-0
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
</code></pre>
