<@U04S8PLJWMT> Im using Airbyte 1.8.2. When I use ...
# ask-ai
c
@kapa.ai Im using Airbyte 1.8.2. When I use Terraform to create a connection, I get below error. Im using service account for AWS EKS. That has been provided in the global.serviceAccountName
Copy code
unknown status code returned: Status 500
│ {"status":500,"type":"https://reference.airbyte.com/reference/errors","title":"unexpected-problem","detail":"An unexpected problem has occurred. If this is
│ an error that needs to be addressed, please submit a pull request or github issue.","documentationUrl":null,"data":{"message":"Unable to load AWS credentials
│ from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or
│ AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system
│ properties (aws.accessKeyId and aws.secretKey), WebIdentityTokenCredentialsProvider: Unable to find a region via the region provider chain. Must provide an
│ explicit region in the builder or setup environment to supply a region., com.amazonaws.auth.profile.ProfileCredentialsProvider@1e62710e: profile file cannot
│ be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@4c5dd34f: Unauthorized (Service: null; Status Code: 401; Error Code: null; Request ID:
│ null; Proxy: null)]"}}
k
New message text here
c
@kapa.ai My connector-sidecar pod has environment variables AWS_SECRET_ACCESS_KEY=undefined AWS_ACCESS_KEY_ID=undefined Are these causing the issue?
k
A message from kapa.ai
Yes, having
AWS_SECRET_ACCESS_KEY=undefined
and
AWS_ACCESS_KEY_ID=undefined
in your connector-sidecar pod environment variables can cause issues if your Airbyte deployment is expecting to use these environment variables for AWS authentication. The error message you received indicates that Airbyte is attempting to use the
EnvironmentVariableCredentialsProvider
but is unable to load valid AWS credentials from the environment variables, which matches what you are seeing (
undefined
values are not valid credentials). However, if you are using IRSA (IAM Roles for Service Accounts) on EKS, you should not need to set these environment variables manually. Instead, the pod must be running with the correct Kubernetes service account that is annotated with the appropriate IAM role. If the service account is not set correctly, or if the pod is falling back to the default service account, IRSA will not work and the AWS SDK will continue to look for credentials in the environment variables, which are currently set to `undefined`—leading to authentication failures. This issue has been observed in Airbyte deployments where the service account is not properly propagated to all workload pods, causing the AWS SDK to fail to find credentials via IRSA and fall back to environment variables, which are either missing or set to invalid values like
undefined
[see related discussion](https://github.com/airbytehq/airbyte/issues/50979). Summary: - If you are using IRSA, ensure your pods are running with the correct service account and do not set AWS credentials as environment variables. - If you are not using IRSA, you must provide valid AWS credentials in the environment variables;
undefined
will not work and will cause authentication errors. If you continue to see
undefined
for these variables, review your Helm values and deployment configuration to ensure credentials are set correctly or that IRSA is properly configured and propagated to all relevant pods.
c
@kapa.ai I have not added these environment variables via the values file. Can I exclude these from being automatically added to pods environment variables?
k
A message from kapa.ai
The knowledge sources do not explicitly document a way to prevent the automatic addition of
AWS_ACCESS_KEY_ID
and
AWS_SECRET_ACCESS_KEY
environment variables to Airbyte pods if you have not set them in your values file. However, several sources and GitHub issues indicate that these variables are expected to be set either via Kubernetes secrets or through IRSA, and that missing or invalid values (like
undefined
) can cause authentication failures. If you are using IRSA (IAM Roles for Service Accounts) and do not want these environment variables to be set, you should ensure that: - You do not define them in your
values.yaml
. - Your pods are running with the correct service account that has the necessary IAM role attached. There is no direct documentation in the provided sources about a Helm value or configuration to explicitly exclude or unset these environment variables if they are being set automatically by the chart or operator. If they are appearing as
undefined
without you setting them, it may be due to a default behavior in the Helm chart or a misconfiguration. If this is causing issues, you may want to check for any updates or open an issue with the Airbyte team, as similar problems have been discussed in the community and GitHub issues, particularly around service account propagation and IRSA usage ([see related issue](https://github.com/airbytehq/airbyte/issues/50979)). In summary: There is no documented way in the provided knowledge sources to prevent these environment variables from being automatically added if you have not set them. If you are using IRSA, they should not be required, and their presence as
undefined
suggests a configuration issue. Double-check your service account setup and consider reaching out to Airbyte support or the community if the problem persists.
c
@kapa.ai The solution is as below 1. Create EKS service account before airbyte deployment 2. Name the service account as airbyte-admin 3. Add relevant AWS policies for your resources 4. add global.env_vars.AWS_REGION 5. Add serviceAccount.create=false 6. Add global.serviceAccountName=airbyte-admin 7. Add worker.job.kube.serviceAccount=airbyte-admin Service account Terraform as below
Copy code
# IAM Roles for Service Accounts setup to be used by ALL Airbyte pods
resource "aws_iam_role" "airbyte_global_irsa_role" {
  name = "airbyte-global-irsa-role"

  assume_role_policy = jsonencode({
    Version = "2012-10-17",
    Statement = [
      {
        Effect = "Allow",
        Principal = {
          Federated = aws_iam_openid_connect_provider.eks.arn
        },
        Action = "sts:AssumeRoleWithWebIdentity",
        Condition = {
          StringEquals = {
            "${replace(data.aws_eks_cluster.this.identity[0].oidc[0].issuer, "https://", "")}:sub" : [
              "system:serviceaccount:airbyte:airbyte-admin",
              "system:serviceaccount:airbyte:default",
            ]
          }
        }
      }
    ]
  })
}

resource "aws_iam_role_policy_attachment" "airbyte_global_policy_attach" {
  role       = aws_iam_role.airbyte_global_irsa_role.name
  policy_arn = var.custom_instance_policy_arn
}

resource "kubernetes_service_account" "airbyte_global_irsa" {
  metadata {
    name      = "airbyte-admin"
    namespace = "airbyte"
    annotations = {
      "eks.amazonaws.com/role-arn" = aws_iam_role.airbyte_global_irsa_role.arn
    }
  }
}

# ---- Kubernetes ClusterRole for full permissions ----
resource "kubernetes_cluster_role" "airbyte_global_full_access" {
  metadata {
    name = "airbyte-global-full-access"
  }

  rule {
    api_groups = ["*"]
    resources  = ["*"]
    verbs      = ["*"]
  }

  rule {
    non_resource_urls = ["*"]
    verbs             = ["*"]
  }
}

# ---- ClusterRoleBinding to connect the ClusterRole to the ServiceAccount ----
resource "kubernetes_cluster_role_binding" "airbyte_global_full_access_binding" {
  metadata {
    name = "airbyte-global-full-access-binding"
  }

  role_ref {
    api_group = "rbac.authorization.k8s.io"
    kind      = "ClusterRole"
    name      = kubernetes_cluster_role.airbyte_global_full_access.metadata[0].name
  }

  subject {
    kind      = "ServiceAccount"
    name      = kubernetes_service_account.airbyte_global_irsa.metadata[0].name
    namespace = kubernetes_service_account.airbyte_global_irsa.metadata[0].namespace
  }
}
k
A message from kapa.ai
Your outlined solution for configuring Airbyte on EKS with IRSA and a custom service account named
airbyte-admin
aligns well with the best practices and known workarounds discussed in the Airbyte community and GitHub issues. Here’s a review of your steps, referencing the knowledge sources: 1. Create EKS service account before Airbyte deployment This is recommended, especially if you want to manage the service account externally and avoid Helm deleting/recreating it during upgrades. This approach is confirmed as a workaround in the community: > "You can do so like this... then create/manage the service account through your alternative methodology of choice..." [Helm upgrade deletes and recreates serviceaccount](https://github.com/airbytehq/airbyte/issues/18731) 2. Name the service account as
airbyte-admin
Several issues highlight that Airbyte (especially in certain versions) defaults to using
airbyte-admin
for workload pods, and hardcoding this name avoids issues with missing service accounts or failed pod launches: > "Cannot start replication pods when using a service account not named
airbyte-admin
..." [Cannot start replication pods when using a service account not named
airbyte-admin
](https://github.com/airbytehq/airbyte/issues/49938) 3. Add relevant AWS policies for your resources This is required for IRSA to work, as described in the official documentation for S3 and Secrets Manager integration: [Deploying Airbyte on AWS](https://docs.airbyte.com/platform/deploying-airbyte/infrastructure/aws) 4. Add
global.env_vars.AWS_REGION
The error logs and issues indicate that the AWS region must be set, or the SDK will fail to authenticate: > "Unable to find a region via the region provider chain. Must provide an explicit region..." [Workload pods are missing the service account](https://github.com/airbytehq/airbyte/issues/50979) 5. Add
serviceAccount.create=false
This prevents Helm from managing the service account, which is necessary if you want to manage it externally (e.g., via Terraform): [Helm upgrade deletes and recreates serviceaccount](https://github.com/airbytehq/airbyte/issues/18731) 6. Add
global.serviceAccountName=airbyte-admin
This ensures the correct service account is referenced globally in the Helm chart. [Cannot start replication pods when using a service account not named
airbyte-admin
](https://github.com/airbytehq/airbyte/issues/49938) 7. Add
worker.job.kube.serviceAccount=airbyte-admin
This is necessary to ensure that the worker pods use the correct service account, as some issues have shown that this value must be set explicitly for the workload pods to pick up the right service account: [Cannot start replication pods when using a service account not named
airbyte-admin
](https://github.com/airbytehq/airbyte/issues/49938) Your Terraform code for the service account, IAM role, and RBAC bindings is consistent with the requirements for IRSA and Kubernetes RBAC. Summary: Your approach is validated by the knowledge sources and addresses known issues with service account propagation and IRSA in Airbyte on EKS. The key is to ensure all workload pods use the correct service account and that the AWS region is set, as missing or misconfigured values are a common cause of authentication failures. If you follow these steps, you should avoid the issues described in the GitHub issues and documentation. If you encounter further problems, double-check pod service account assignments and Helm value propagation as described in the linked issues.