Skip to main content
Skip table of contents

Scheduling Telemetry Upload

If you want to upload telemetry data on a schedule, you can use the following example as an aid to set up a Cron Job that runs the telemetry command for you on a regular basis. The recommended frequency for data upload is every three months.

For more information around the gathered data, collection purposes, and data storage location, see Telemetry.

A bundle is tied to a specific cluster. If you want to set up a schedule for more than one cluster in your environment, set up a CronJob for each cluster individually.

This feature is currently not available in air-gapped environments.

Prerequisites

  • Access to the cluster’s kubeconfig file.

  • Your cluster nodes must have access to the Internet.

Create and Enable the CronJob

The following example shows a Kubernetes CronJob that manages running a command on an established schedule inside the cluster.

  1. Create a file with the schedule using the Cron Syntax. In this example, the job is called telemetry and runs four times a year, starting on the first day of the third month from the configuration date.

    CODE
    apiVersion: batch/v1
    kind: CronJob
    metadata:
      name: telemetry
    spec:
      schedule: "0 0 1 */3 *"
      jobTemplate:
        spec:
          template:
            spec:
              serviceAccountName: telemetry-collector
              restartPolicy: OnFailure
              containers:
                - name: telemetry
                  image: alpine:3.6
                  imagePullPolicy: IfNotPresent
                  env:
                  - name: DKP_VERSION
                    value: v2.6.1
                  command:
                    - /bin/sh
                    - -c
                    - |
                      apk update && apk add curl
                      curl -L https://downloads.d2iq.com/dkp/${DKP_VERSION}/dkp_${DKP_VERSION}_linux_amd64.tar.gz | tar -xz
                      ./dkp upload telemetry --bundle-profile diagnostics
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: telemetry-collector
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      name: telemetry-collector
    rules:
      - apiGroups: ["*"]
        resources: ["*"]
        verbs: ["get", "watch", "list"]
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: telemetry-collector
      namespace: default
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: telemetry-collector
    subjects:
      - kind: ServiceAccount
        namespace: default
        name: telemetry-collector
    

    (info) Specify a different --bundle-profile flag if you want to limit the amount of shared data. See Sending Telemetry Data for Analysis for more information on the telemetry profile.

  2. Apply the created file to the cluster where you would like to automate the command. Replace the placeholder <target_cluster_kubeconfig> with the path to the target cluster's kubeconfig file:

    CODE
    kubectl apply -f CronJob.yaml --kubeconfig=<target_cluster_kubeconfig>

Alternative: Set up GitHub Actions to execute a workflow on a schedule for your cluster

GitHub Actions

In this section, we provide an alternative to set up a workflow that manages running the command on a schedule. This is an alternative for organizations that already use GitHub Actions and wish to use it to manage this workflow as well.

Prerequisites

  • Access to the cluster’s kubeconfig file.

  • A GitHub Actions account.

Create and Enable GitHub Actions

Here is an example of how you could configure a GitHub Actions workflow for the telemetry command. In this example, the command runs four times a year, starting on the first day of the third month from the configuration date.

Replace the placeholder <target_cluster_kubeconfig> with the path to the target cluster's kubeconfig file:

CODE
name: Run DKP telemetry upload command on the cluster
on:
  schedule:
    - cron: "0 0 1 */3 *"

jobs:
  telemetry:
    runs-on:
      - ubuntu-latest

    steps:
      ...
      - name: Upload telemetry data
        env:
          DKP_VERSION: v2.6.1
        run: |
          # DKP_TAR_FILE_URL is a download link to DKP binary
          curl -L https://downloads.d2iq.com/dkp/${DKP_VERSION}/dkp_${DKP_VERSION}_linux_amd64.tar.gz | tar -xz
          ./dkp upload telemetry --bundle-profile diagnostics --kubeconfig <target_cluster_kubeconfig>

Specify a different --bundle-profile flag if you want to limit the amount of shared data. See Sending Telemetry Data for Analysis for more information on the restricted telemetry profile.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.