apiVersion: v1
kind: Service
metadata:
  name: hello-app-svc
  namespace: default
spec:
  clusterIP: None
  selector:
    app: hello-app
  ports:
  - name: port-80
    port: 80
    targetPort: 8080
    protocol: TCP
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: hello-app-sf
  namespace: default
spec:
  serviceName: hello-app-svc
  replicas: 2
  selector:
    matchLabels:
      app: hello-app
  template:
    metadata:
      labels:
        app: hello-app
    spec:
      containers:
      - name: hello-app
        image: gcriogooglesamples/hello-app:1.0
        ports:
        - name: http
          containerPort: 8080
        volumeMounts:
        - name: vdata
          mountPath: /data
  volumeClaimTemplates:
    - metadata:
        name: vdata
      spec:
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: 2Gi
