apiVersion: apps/v1
kind: Deployment
metadata:
  name: ebay-app-1
spec:
  selector:
    matchLabels:
      environment: dev
      app: ebay
  replicas: 1
  template:
    metadata:
      labels:
        environment: dev
        app: ebay
    spec:
      volumes:
      - name: volume
        hostPath:
          path: /mnt/data  
      containers:
      - name: container1-nginx
        image: nginx
        volumeMounts:
        - name: volume
          mountPath: "/var/nginx-data"
      - name: container2-tomcat
        image: tomcat
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ebay-app-2
spec:
  selector:
    matchLabels:
      environment: dev
      app: ebay
  replicas: 1
  template:
    metadata:
      labels:
        environment: dev
        app: ebay
    spec:
      volumes:
      - name: volume
        hostPath:
          path: /mnt/data  
      containers:
      - name: container1-nginx
        image: nginx
        volumeMounts:
        - name: volume
          mountPath: "/var/nginx-data"
      - name: container2-tomcat
        image: tomcat
        volumeMounts:
        - name: volume
          mountPath: "/var/tomcat-data"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ebay-app-3
spec:
  selector:
    matchLabels:
      environment: dev
      app: ebay
  replicas: 1
  template:
    metadata:
      labels:
        environment: dev
        app: ebay
    spec:
      volumes:
      - name: volume1
        hostPath:
          path: /mnt/data1
      - name: volume2
        hostPath:
          path: /mnt/data2
      containers:
      - name: container1-nginx
        image: nginx
        volumeMounts:
        - name: volume1
          mountPath: "/var/nginx-data"
      - name: container2-tomcat
        image: tomcat
        volumeMounts:
        - name: volume2
          mountPath: "/var/tomcat-data"
---
# hostPath using nfs
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ebay-app-4
spec:
  selector:
    matchLabels:
      environment: dev
      app: ebay
  replicas: 2
  template:
    metadata:
      labels:
        environment: dev
        app: ebay
    spec:
      volumes:
      - name: volume
        hostPath:
          path: /mnt/data  
      containers:
      - name: container1-nginx
        image: nginx
        volumeMounts:
        - name: volume
          mountPath: "/var/nginx-data"
      - name: container2-tomcat
        image: tomcat
        volumeMounts:
        - name: volume
          mountPath: "/var/tomcat-data"
