Data from your laptop sourced from a kuberneties pod

I recently needed to have data from my laptop be sourced from a kuberneties pod due to some security setups. I found that mirrord could do that. You have to install it, I’ll let you figure out how. I just did a brew install as I am using a Mac, but it was super easy. Then I had to put in my config file

 % cd ~/.mirrord         
 % ls -a
.             ..            .mirrord.json
% more .mirrord.json 
{
    "feature": {
      "network": {
        "incoming": "steal",
        "outgoing": true
      },
      "fs": "read",
      "env": true
    },
    "kubeconfig": "~/.kube/kube-prod.conf",
    "agent": {
      "namespace": "NAMESPACE_I_NEEDED",
      "log_level": "info",
      "json_log": true,  
      "communication_timeout": 300,
      "startup_timeout": 3600
    },
    "target": {
      "namespace": "NAMESPACE_I_NEEDED"
    }
  }

Next I set a system var to the pod name

export PODNAME= THE POD NAME YOU WANT

After that you can just run

mirrord exec --target pod/$PODNAME -n NAMESPACE YOU NEED -- python name_of_your_python_file.py