apiVersion: v1
kind: Pod
metadata:
  name: fortune-env-from-configmap
  namespace: chp07-set743
spec:
  volumes:
  - name: html # match spec.containers[].volumeMounts.name
    emptyDir: {}
  containers:

  - image: georgebaptista/fortune:env
    name: html-generator
    env:
    - name: INTERVAL # define env var
      valueFrom: # init from ConfigMap key, sleep-interval
        configMapKeyRef:
          name: fortune-config # name of ConfigMap to use
          key: sleep-interval # value to inject from ConfigMap
    - name: LOCATION
      valueFrom:
        configMapKeyRef:
          name: fortune-config
          key: location
    volumeMounts:
    - name: html
      mountPath: /var/htdocs
  
  - image: nginx:alpine
    name: web-server
    volumeMounts:
    - name: html
      mountPath: /usr/share/nginx/html
      readOnly: true
    ports:
    - containerPort: 80
      protocol: TCP

