title: Run kubectl command from GKE cronjob using workload identity
body: <p>I'd like to run a kubectl command from within a <code>cronjob</code> pod, to change the min replicas on a HPA for a deployment at the same time every week, i.e. time based scaling. I've been playing around with using the official google-sdk image with gcloud and kubectl installed.</p>
  <p>I know I need to authenticate to the GKE cluster before I can run commands to interact via kubectl, and I really wanted to steer away from mounting a service account key (via a secret) to the pod, as we already have workload identity enabled.</p>
  <p>Normal gcloud commands work fine using this method e.g. <code>gcloud compute instances list</code> but when I run <code>gcloud container clusters get-credentials....</code> it fails saying I need to run <code>gcloud auth login</code> - can't be done of course.</p>
  <p>I've read <a href="https://stackoverflow.com/questions/58566634/how-to-use-kubectl-from-a-cronjob-in-gke">this post</a>, I don't really want to use cURL if I can avoid it,  and also know that gcloud doesn't use <code>GOOGLE_APPLICATION_CREDENTIALS</code> (<a href="https://stackoverflow.com/questions/67394633/how-to-use-gcloud-command-in-docker-build-image-with-credentials">this post</a>)</p>
  <p>Does anyone know of a way I can use workload identity and get this working?</p>