import json


async def _get_kubeconfig(model):
    """Get kubeconfig from kubernetes-master."""
    unit = model.applications["kubernetes-master"].units[0]
    action = await unit.run_action("get-kubeconfig")
    output = await action.wait()  # wait for result
    return json.loads(output.data.get("results", {}).get("kubeconfig", "{}"))