How can i download a list of worker nodes in json format?

I have a big deployment with hundreds of worker nodes. Is there an easy way to download a full list of worker nodes in json format?

If you don’t have access to the CLI to perform an API call, here’s a JavaScript snippet that you can paste into your Browser’s Developer Console. Once the Fetch (JavaScript’s curl, essentially) resolves, it should download a JSON file with the results.

fetch(`${window.location.origin}/api/v1/master/workers`, {
    "headers": {
      "authorization": `Bearer ${localStorage.AUTH_TOKEN}`,
    },
    "body": null,
    "method": "GET",
    "mode": "cors",
    "credentials": "include"
  })
  .then(response => response.blob())
  .then(blob => {
    let url = window.URL.createObjectURL(blob);
    let a = document.createElement('a');
    a.href = url;
    a.download = 'worker_list.json';
    document.body.appendChild(a);
    a.click();
    a.remove();
  });
1 UpGoat

I love it when you talk javascript to me. :smiling_face_with_three_hearts: