apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    tier: backend
    app: nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
      tier: backend
  template:
    metadata:
      labels:
        app: nginx
        tier: backend
    spec:
      volumes:
      - name: dir
        hostPath:
          path: /code
      - name: config
        configMap:
          name: nginx-config
          items:
          - key: config
            path: site.conf
      containers:
      - name: nginx
        image: nginx
        volumeMounts:
        - name: dir
          mountPath: /code
        - name: config
          mountPath: /etc/nginx/conf.d
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
