Authentication error with Kubernetes

I am working on a system that is spread across both Digital Ocean and AWS. Their Node.js instances are on a Kubernetes cluster on Digital Ocean and their databases and S3 spaces are hosted on AWS. I was able to connect to the Kubernetes cluster using kubectl. Then, I was able to do a ‘terraform init’ with no issues. But, when I tried to do a ‘terraform plan’, I got this error.

Error: Error retrieving Kubernetes cluster: GET https://api.digitalocean.com/v2/kubernetes/clusters/1234: 401 Unable to authenticate you.

I am new to both Kubernetes and Terraform. Does Terraform expect the Kubernetes config information to be in a different place then where kubectl expects it?

Hi Mike,
kubectl stores cluster access details in a file named ~/.kube/config, which is also where the Kubernetes provider will attempt to read access details.
However, you may need to tell the Kubernetes provider which cluster / context it should be using as this file can contain access details for multiple clusters.
See the following documentation for more info: