def create_rke_cluster(
        rke_client, kubectl, nodes, rke_template, **rke_template_kwargs):
    """
    Creates a cluster and returns the rke config as a python dictionary
    """

    # create rke cluster yml
    config_yml, nodes = rke_client.build_rke_template(
        rke_template, nodes, **rke_template_kwargs)

    # run rke up
    result = rke_client.up(config_yml)
    assert result.ok, result.stderr

    # validate k8s reachable
    kubectl.kube_config_path = rke_client.kube_config_path()

    return rke_client.convert_to_dict(config_yml)