# A headless service to create DNS records apiVersion: v1 kind: Service metadata: annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" name: nginx labels: app: nginx-statefulset spec: ports: - port: 80 name: web # *.nginx.default.svc.cluster.local clusterIP: None selector: app: nginx-statefulset --- apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: nginx spec: serviceName: "nginx" replicas: 0 template: metadata: labels: app: nginx-statefulset spec: terminationGracePeriodSeconds: 0 containers: - name: nginx image: gcr.io/google_containers/nginx-slim:0.7 ports: - containerPort: 80 name: web command: - sh - -c - 'while true; do sleep 1; done'