<p>I want to use service per pod, but I didn't found how to run service per pod of type nodePort.</p>
<p>I was trying to use that, but every service is created of type ClusterIP
<a href="https://github.com/metacontroller/metacontroller/tree/master/examples/service-per-pod" rel="nofollow noreferrer">https://github.com/metacontroller/metacontroller/tree/master/examples/service-per-pod</a></p>
<p>I need to create pod together with service of type nodePort.</p>
<p>Current configuration</p>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: nginx
  annotations:
    service-per-pod-label: &quot;statefulset.kubernetes.io/nginx&quot;
    service-per-pod-ports: &quot;80:80&quot;
spec:
  selector:
    matchLabels:
      app: nginx
  serviceName: nginx
  replicas: 3
  template:
    metadata:
      labels:
        app: nginx
    spec:
      terminationGracePeriodSeconds: 1
      containers:
      - name: nginx
        image: gcr.io/google_containers/nginx-slim:0.8
        ports:
        - containerPort: 80
          name: web
    ```

</code></pre>

korallo
<p><code>ClusterIP</code> is the default type. Define the type <code>NodePort</code> in the spec section if you want to use that.</p>
<pre><code>spec:
  type: NodePort
</code></pre>
