How to stop kubernetes from reporting to usage.projectcalico.org?

5/22/2019

I found that my kubernetes cluster was sending reports to usage.projectcalico.org, how can this be disabled and how exactly is it using usage.projectcalico.org?

-- Alex Cohen
kubernetes
project-calico

2 Answers

5/22/2019

According to the source code:

    # Disable Usage Reporting to usage.projectcalico.org
    # We want to avoid polluting analytics data with unit test noise
    curl_etcd("calico/v1/config/UsageReportingEnabled",
                   options=["-XPUT -d value=False"], ip=ip)

And here is the definition of curl_etcd

def curl_etcd(path, options=None, recursive=True, ip=None):
    """
    Perform a curl to etcd, returning JSON decoded response.
    :param path:  The key path to query
    :param options:  Additional options to include in the curl
    :param recursive:  Whether we want recursive query or not
    :return:  The JSON decoded response.
    """
    if options is None:
        options = []
    if ETCD_SCHEME == "https":
        # Etcd is running with SSL/TLS, require key/certificates
        rc = check_output(
            "curl --cacert %s --cert %s --key %s "
            "-sL https://%s:2379/v2/keys/%s?recursive=%s %s"
            % (ETCD_CA, ETCD_CERT, ETCD_KEY, ETCD_HOSTNAME_SSL,
               path, str(recursive).lower(), " ".join(options)),
            shell=True)
    else:
        rc = check_output(
            "curl -sL http://%s:2379/v2/keys/%s?recursive=%s %s"
            % (ip, path, str(recursive).lower(), " ".join(options)),
            shell=True)

    return json.loads(rc.strip())
-- Oz123
Source: StackOverflow

5/23/2019

Felix is the Calico component that sends usage information.

Felix can be configured to disable the usage ping.

Set the FELIX_USAGEREPORTINGENABLED environment variable can be to "false" (needs to be a string!) in the calico-node DaemonSet

Set the UsageReportingEnabled field in the FelixConfiguration resource to false. This could be in etcd or in the Kubernetes API depending on what store you use. Both modifiable with calicoctl.

If you happen to be using kubespray, modifying this setting is a little hard as these variables are not exposed to Ansible, other than by manually modifying templates.

-- Matt
Source: StackOverflow