apiVersion: apps/v1
kind: Deployment
metadata:
  name: target-v2-1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: target
      version: "2.1"
  template:
    metadata:
      labels:
        app: target
        version: "2.1"
    spec:
      containers:
      - name: target-v2-1
        image: "nginx"
        ports:
        - containerPort: 80
          name: http
        volumeMounts:
          - mountPath: /etc/nginx
            name: nginx-config
      volumes:
        - name: nginx-config
          configMap:
            name: target-v2-1
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: target-v2-1
data:
  nginx.conf: |-
    events {}
    http {
      server {
        listen 80;
        location / {
          return 200 "target v2.1\n";
        }
      }
    }
---
apiVersion: v1
kind: Service
metadata:
  name: target-v2-1
spec:
  ports:
  - port: 80
    targetPort: 80
    protocol: TCP
    name: http
  selector:
    app: target
    version: "2.1"
