spotinst / terraform-spotinst-ocean-eks

[Deprecated] A Terraform module to create an Amazon Elastic Kubernetes Service (EKS) cluster with Ocean.
https://registry.terraform.io/modules/spotinst/ocean-eks/spotinst
Apache License 2.0
21 stars 30 forks source link

AWS-auth configmap connection refused - kubernetes provider required #29

Open galshmil opened 2 years ago

galshmil commented 2 years ago

Hello! There is a problem in the current module while using terraform-aws-modules/eks/aws in the eks.tf section. In order to be able to properly connect to the cluster (which is needed to create/manage the aws_auth_configmap) a kubernetes provider is needed to be set. I fixed it by adding in my provider.tf the following:

provider "kubernetes" {
  host                   = module.ocean-eks.cluster_endpoint
  cluster_ca_certificate = base64decode(module.ocean-eks.cluster_ca_certificate)

  exec {
    api_version = "client.authentication.k8s.io/v1beta1"
    command     = "aws"
    args        = ["eks", "get-token", "--cluster-name", module.ocean-eks.cluster_id]
  }
}

This can (and I think should) be added inside the module itself. Or at least in the required section in the documentation

galshmil commented 2 years ago

Noticed that it is shown in the simple-cluster example. I think that also writing something about it in the terraform.io can be a good thing as well.