def METHOD_NAME(node, runtime_cli):
    """
    Builds a mapping of running pod names to host pids.
    """
    binaries = {
        'docker': 'docker',
        'crictl': 'crictl',
    }
    ps_templates = {
        'docker': '''--format   '{{.State.Pid}} {{index .Config.Labels \\"io.kubernetes.pod.name\\"}}' ''',
        'crictl': '''--template '{{.info.pid}}  {{index .info.config.labels \\"io.kubernetes.pod.name\\"}}' ''',
    }
    binary = binaries[runtime_cli]
    ps_template = ps_templates[runtime_cli]
    # This command prints one line of output per container where each line is the pid of the container, a
    # single space and the name of the k8s pod determined by the io.kubernetes.pod.name container label.
    # See the output below for example output:
    # $ sudo crictl ps -q | sudo xargs crictl inspect --template \
    #     '{{.info.pid}} {{index .info.config.labels "io.kubernetes.pod.name"}}' -o go-template
    # 3635260 vizier-pem-sx7pr
    # 3634678 kelvin-cdf78c57c-qlzlb
    cmd = (
        f"kubectl node-shell {node} -- "
        f"sudo bash -c \"{binary} ps -q | xargs {binary} inspect -o go-template {ps_template}\""
    )
    pod2pid = {}
    ps_out = subprocess.run(cmd, shell=True, capture_output=True)
    rows = ps_out.stdout.decode('utf-8').splitlines()
    for row in rows:
        split_row = row.split()
        if len(split_row) != 2:
            print(f"Failed to parse config for row: {row}. Skipping to new pid")
            continue
        pid, pod_name = split_row
        pod2pid[pod_name] = pid
    return pod2pid