title: Kubernetes service as env var to frontend usage
body: <p>I'm trying to configure kubernetes and in my project I've separeted UI and API.
  I created one Pod and I exposed both as services.</p>
  
  <p>How can I set API_URL inside pod.yaml configuration in order to send requests from user's browser?</p>
  
  <p>I can't use localhost because the communication isn't between containers.</p>
  
  <p>pod.yaml</p>
  
  <pre><code>apiVersion: v1
  kind: Pod
  metadata:
    name: project
    labels:
      name: project
  spec:
    containers:
    - image: 'ui:v1'
      name: ui
      ports:
      - name: ui
        containerPort: 5003
        hostPort: 5003
      env:
      - name: API_URL
        value: &lt;how can I set the API address here?&gt;
    - image: 'api:v1'
      name: api
      ports:
      - name: api
        containerPort: 5000
        hostPort: 5000
      env:
      - name: DATABASE_URL
        valueFrom:
        secretKeyRef:
          name: postgres-url
          key: url
  </code></pre>
  
  <p>services.yaml</p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: api
    labels:
      name: api
  spec:
    type: NodePort
    ports:
    - name: 'http'
      protocol: 'TCP'
      port: 5000
      targetPort: 5000
      nodePort: 30001
    selector:
      name: project
  ---
  apiVersion: v1
  kind: Service
  metadata:
    name: ui
    labels:
      name: ui
  spec:
    type: NodePort
    ports:
    - name: 'http'
      protocol: 'TCP'
      port: 80
      targetPort: 5003
      nodePort: 30003
    selector:
      name: project
  </code></pre>