Reputation: 97
I want to use service per pod, but I didn't found how to run service per pod of type nodePort.
I was trying to use that, but every service is created of type ClusterIP https://github.com/metacontroller/metacontroller/tree/master/examples/service-per-pod
I need to create pod together with service of type nodePort.
Current configuration
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: nginx
annotations:
service-per-pod-label: "statefulset.kubernetes.io/nginx"
service-per-pod-ports: "80:80"
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
```
Upvotes: 0
Views: 294
Reputation: 334
ClusterIP
is the default type. Define the type NodePort
in the spec section if you want to use that.
spec:
type: NodePort
Upvotes: 1