Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform Kubernetes Provider Fails to Connect to EKS Cluster in GitLab CI Pipeline: "dial tcp [::1]:80: connect: connection refused" [closed] #2677

Open
nibrazrehaman opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels

Comments

@nibrazrehaman
Copy link

nibrazrehaman commented Jan 23, 2025

Description

When the pipeline runs terraform apply, it fails with the following error:

Error: Get "http://localhost/api/v1/namespaces/kube-system/configmaps/aws-auth": dial tcp [::1]:80: connect: connection refused

`with kubernetes_config_map_v1_data.aws_auth, on aws_auth.tf line 1, in resource "kubernetes_config_map_v1_data" "aws_auth": 1: resource "kubernetes_config_map_v1_data" "aws_auth" {

Error: Get "http://localhost/api?timeout=32s": dial tcp [::1]:80: connect: connection refused

with kubernetes_env.aws_node, on k8s.tf line 2, in resource "kubernetes_env" "aws_node": 2: resource "kubernetes_env" "aws_node" {`

Terraform, AWS provider and Kubernetes version

Terraform version:  1.6.4
Aws Provider version: 5.84.0
Kubernetes version: 2.35.1

Terraform configuration

provider "kubernetes" {
  host                   = data.aws_eks_cluster.gis.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.gis.certificate_authority[0].data)
  token                  = data.aws_eks_cluster_auth.gis.token
}

data "aws_eks_cluster" "gis" {
  name = "my-cluster-name"
}
 
data "aws_eks_cluster_auth" "gis" {
  name = data.aws_eks_cluster.gis.name
}

Question

  1. What could be causing the Kubernetes provider to fail during the EKS upgrade from version 1.27 to 1.28?
  2. Are there any additional configurations or Terraform-specific steps required to ensure compatibility and a successful upgrade in the GitLab CI pipeline?

Steps to Reproduce

  1. Use the provided Terraform configuration.
  2. Initiate an EKS cluster upgrade from version 1.27 to 1.28 in a GitLab CI pipeline.
  3. Observe the error during the terraform apply step.

Expected Behavior

  1. The Kubernetes provider should connect to the correct EKS cluster endpoint during the upgrade.
  2. The EKS cluster upgrade process should complete successfully without errors.
  3. Any insights into resolving this issue would be greatly appreciated!

Thank you in advance for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants