apiVersion: v1
kind: Service
metadata:
  name: demo-service
  labels:
    app: demo
spec:
  type: NodePort
  ports:
  - port: 8080
    name: http
  selector:
    app: demo
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: demo-v1
  labels:
    app: demo
    version: v1
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: demo
        version: v1
    spec:
      containers:
      - name: webserver
        image: ehazlett/docker-demo
        resources:
          requests:
            cpu: "100m"
        imagePullPolicy: IfNotPresent #Always
        ports:
        - containerPort: 8080
        env:
        - name: VERSION
          value: "v1"
        - name: METADATA
          value: "production"


---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: demo-v2
  labels:
    app: demo
    version: v2
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: demo
        version: v2
    spec:
      containers:
      - name: webserver
        image: ehazlett/docker-demo
        resources:
          requests:
            cpu: "100m"
        imagePullPolicy: IfNotPresent #Always
        ports:
        - containerPort: 8080
        env:
        - name: VERSION
          value: "v2"
        - name: METADATA
          value: "staging"

---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: demo-v3
  labels:
    app: demo
    version: v3
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: demo
        version: v3
    spec:
      containers:
      - name: webserver
        image: ehazlett/docker-demo
        resources:
          requests:
            cpu: "100m"
        imagePullPolicy: IfNotPresent #Always
        ports:
        - containerPort: 8080
        env:
        - name: VERSION
          value: "v3"
        - name: METADATA
          value: "dev"
