apiVersion: apps/v1
kind: Deployment
metadata:
  name: green
  labels:
    app: green
spec:
  replicas: 1
  selector:
    matchLabels:
      app: green
  template:
    metadata:
      labels:
        app: green
    spec:
      volumes:
      - name: websitedata
        emptyDir: {}
      initContainers:
      - name: webcontent
        image: busybox
        volumeMounts:
        - name: websitedata
          mountPath: /websitedata
        command: ["/bin/sh"]
        args: ["-c", 'echo "<h1>Welcome to <font color=green> http://vcloud-lab.com Green_Application</font></h1>" > /websitedata/index.html']
      containers:
      - name: green
        image: nginx
        ports:
        - containerPort: 80
        volumeMounts:
        - name: websitedata
          mountPath: "/usr/share/nginx/html" #For nginx image path - "/usr/share/nginx/html"
          readOnly: true

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: blue
  labels:
    app: blue
spec:
  replicas: 1
  selector:
    matchLabels:
      app: blue
  template:
    metadata:
      labels:
        app: blue
    spec:
      volumes:
      - name: websitedata
        emptyDir: {}
      initContainers:
      - name: webcontent
        image: busybox
        volumeMounts:
        - name: websitedata
          mountPath: /websitedata
        command: ["/bin/sh"]
        args: ["-c", 'echo "<h1>Welcome to <font color=blue> http://vcloud-lab.com BLUE_Application</font></h1>" > /websitedata/index.html']
      containers:
      - name: blue
        image: nginx
        ports:
        - containerPort: 80
        volumeMounts:
        - name: websitedata
          mountPath: /usr/share/nginx/html #For nginx image path - "/usr/share/nginx/html"