def get_core_api():
    """
    Create instance of Core V1 API of kubernetes:
    https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/CoreV1Api.md
    :return: instance of client
    """
    global core_api

    if core_api is None:
        config.load_kube_config()
        if API_KEY is not None:
            # Configure API key authorization: BearerToken
            configuration = client.Configuration()
            configuration.api_key['authorization'] = API_KEY
            configuration.api_key_prefix['authorization'] = 'Bearer'
            core_api = client.CoreV1Api(client.ApiClient(configuration))
        else:
            core_api = client.CoreV1Api()

    return core_api
Create instance of Core V1 API of kubernetes:
    https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/CoreV1Api.md
    :return: instance of client