# return POD-IP
# under contruction
---
apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod-ip
  labels:
    run: nginx-pod-ip
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - containerPort: 80
    volumeMounts:
    - name: workdir
      mountPath: /usr/share/nginx/html
  initContainers:
  - name: install
    image: busybox
    env:
      - name: MY_NODE_NAME
        valueFrom:
          fieldRef:
            fieldPath: spec.nodeName
      - name: MY_POD_NAME
        valueFrom:
          fieldRef:
            fieldPath: metadata.name
      - name: MY_POD_NAMESPACE
        valueFrom:
          fieldRef:
            fieldPath: metadata.namespace
      - name: MY_POD_IP
        valueFrom:
          fieldRef:
            fieldPath: status.podIP
      - name: MY_POD_SERVICE_ACCOUNT
        valueFrom:
          fieldRef:
            fieldPath: spec.serviceAccountName
    command: [ "echo", "-n", "MY_POD_IP", ">", "/data/my-pod-ip" ]
    volumeMounts:
    - name: workdir
      mountPath: /data
  volumes:
  - name: workdir
    emptyDir: {}


  
