I need to call kubectl
from within another program that has credentials in the Webhook Token Authentication format. Specifically, it’s a Terraform configuration that uses the Terraform Kubernetes Provider, which makes these credentials available as outputs within Terraform.
In normal usage, I would write this YAML config to a file and set the KUBECONFIG env var to that file path. Since I’m calling kubectl
from within another program though, I’d like to find a way to pass these credentials to kubectl
without writing them to file first.
Is there any way to set this authentication config for kubectl
using env vars or as command line parameters? I can’t seem to find any examples of this online, but I’d be surprised if loading from a file on disk was the only available option.
1