apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: nginx
  template:
    metadata:
      labels:
        app.kubernetes.io/name: nginx
    spec:
      serviceAccountName: service-reader
      containers:
        - name: nginx
          image: nginx:latest
          ports:
            - containerPort: 50
              protocol: TCP
          env:
            - name: SERVICE_NAME
              value: nginx-service
          volumeMounts:
            - mountPath: /docker-entrypoint.sh
              name: nginx-config
              subPath: docker-entrypoint.sh
      volumes:
        - name: nginx-config
          configMap:
            name: nginx-config
            defaultMode: 0744
            items:
              - key: docker-entrypoint.sh
                path: docker-entrypoint.sh
