<p>Running this in MINIKUBE before I push to AWS</p>

<p>I am trying a "Man in the middle" on one of my pods. 
Idea, change the hosts file inside my docker container that lives inside a kubernetes pod. The hosts file will see a request to api.app.org and redirect any calls to this host to ip address "10.101.63.179". The application running on the kubernetes service is an express app that captures http requests and directs them to the appropriate method for consumption. 
The app looks at the request headers and breaks out the "host" and the "URL".
Should look like this </p>

<p>host = api.app.org</p>

<p>URL = "/v2/1234"</p>

<p>Expected : 
The kubernetes service will be sent an HTTP request.<br>
example : api.app.org/v2/1234<br>
Node Express app is called and manages execution based on "host" and the rest of the URL. "/v2/1234"</p>

<p>Actual:<br>
1. HOSTS file is updated via Kubernetes hostalias added inside the deployment. Code below.<br>
2. Call from within application makes an HTTP request to "api.app.org/v2/1234" .<br>
3. The HOSTS file redirects the HTTP request to IP address "10.101.63.179"<br>
-- so far so good --</p>

<p>(inside express app now) . </p>

<ol>
<li>Runs a method to extract Host and the rest of the URL.<br>
-- example : host should equal ( api.app.org )<br>
-- example : url should equal (/v2/1234) . </li>
</ol>

<p>PROBLEM...  </p>

<p>host =  10.101.63.179 .  </p>

<p>URL = / .  </p>

<hr>

<p>CODE : /etc/hosts . 
host file from docker image inside kubernetes pod : ran (kubectl exec -it  -c  -- /bin/bash ) . </p>

<p><code># Entries added by HostAliases.
10.101.63.179   api.stats.com
10.101.63.179   api.ap.org</code></p>

<hr>

<p>CODE: Kubernetes Deployment YAML</p>

<p><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  namespace: testharness
  labels:
    run: raven-svc
  name: raven-svc
spec:
  replicas: 1
  selector:
    matchLabels:
      run: raven-svc
  template:
    metadata:
      labels:
        run: raven-svc
    spec:
      containers:
      - name: raven-svc
        image: raven:vFin
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 3000
      hostAliases:
        - ip: "10.101.63.179"
          hostnames:
          - "api.stats.com"
          - "api.ap.org"
      restartPolicy: Always
</code></p>

Wes Duff
<p>The hosts file as basically at IP level in the stack so it wouldn't strip any layer 6-7 headers(http/https). Also kubernetes sets up iptables to route between pods and generally that's all at the IP level too. </p>

<p>Is <code>10.101.63.179</code> an ingress controller by any chance? that could be stripping your headers.</p>
