Terraform Kubernetes provider with EKS fails on configmap

7/1/2018

I've followed the instructions to create an EKS cluster in AWS using Terraform.

https://www.terraform.io/docs/providers/aws/guides/eks-getting-started.html

I've also copied the output for connecting to the cluster to ~/.kube/config-eks. I've verified this successfully works as I've been able to connect to the cluster and manually deploy containers. However, now i'm trying to use the Terraform Kubernetes provider to connect to the cluster but cannot seem to be able to configure the provider properly.

I've configured the provider to use my kubectl configuration but when attempting to push a simple configmap, i get an error stating the following:

configmaps is forbidden: User "system:anonymous" cannot create configmaps in the namespace "kube-system"

I know that the provider is picking up part of the configuration but I cannot seem to get it to authenticate. I suspect this is because EKS uses heptio for authentication and i'm not sure if the K8s Go client used by Terraform can support heptio. However, given that Terraform released their AWS EKS support when EKS went GA, I'd doubt that they wouldn't also update their Terraform provider to work with it.

Is it possible to even do this now? Are there alternatives?

-- loesak
amazon-eks
kubernetes
terraform

1 Answer

7/1/2018

Exec auth was added here: https://github.com/kubernetes/client-go/commit/19c591bac28a94ca793a2f18a0cf0f2e800fad04

This is what is utilized for custom authentication plugins and was published Feb 7th.

Right now, Terraform doesn't support the new exec-based authentication provider, but there is an issue open with a workaround: https://github.com/terraform-providers/terraform-provider-kubernetes/issues/161

That said, if I get some free time I will work on a PR.

-- mootpt
Source: StackOverflow