Skip to main content

atmos aws eks update-kubeconfig

Use this command to download kubeconfig from an EKS cluster and save it to a file.

atmos aws eks-update-kubeconfig --help
 
atmos aws eks update-kubeconfig [options]

This command downloads kubeconfig from an EKS cluster and saves it to a file. It supports multiple execution modes:

  1. CLI parameters only: If all the required parameters (cluster name and AWS profile/role) are provided on the command-line, then Atmos executes the command without requiring the atmos.yaml CLI config and context.

    atmos aws eks update-kubeconfig --profile=<profile> --name=<cluster_name>
  2. Component and stack: If component and stack are provided on the command-line, then Atmos executes the command using the atmos.yaml CLI config and stack's context by searching for the following settings:

    • components.helmfile.cluster_name_template in the atmos.yaml CLI config (and calculates the --name parameter using the Go template; the deprecated components.helmfile.cluster_name_pattern token syntax also works)
    • components.helmfile.helm_aws_profile_pattern in the atmos.yaml CLI config (and calculates the --profile parameter using the pattern)
    • components.helmfile.kubeconfig_path in the atmos.yaml CLI config the variables for the component in the provided stack
    • region from the variables for the component in the stack
    atmos aws eks update-kubeconfig <component> -s <stack>
  3. Combination: Provide a component and a stack, and override other parameters on the command line.

    atmos aws eks update-kubeconfig <component> -s <stack> --kubeconfig=<path_to_kubeconfig> --region=us-east-1
  4. Integration mode: Use a named integration from auth.integrations to authenticate via the Atmos auth system and generate kubeconfig using the Go SDK (no AWS CLI required).

    atmos aws eks update-kubeconfig --integration=dev/eks/primary
  5. Identity mode: Use an Atmos identity directly with explicit cluster parameters. This authenticates via the auth system and uses the Go SDK.

    atmos aws eks update-kubeconfig --name=<cluster_name> --region=<region> --identity=<identity_name>
info

On the Go SDK paths (--identity and --integration), the generated authentication command records the effective absolute working directory in ATMOS_CHDIR, so kubectl can find the same Atmos configuration when run from another directory. Regenerate the kubeconfig if you move that directory; if the directory is removed, the token command warns and runs from the current directory instead. When --region is omitted on the direct identity path and AWS resolves a region from its configuration, Atmos uses the returned cluster ARN to populate the token command's region.

Refer to Update kubeconfig for more information

tip

Run atmos aws eks update-kubeconfig --help to see all the available options

Examples​

# Using component and stack
atmos aws eks update-kubeconfig <component> -s <stack>

# Using explicit CLI parameters (requires AWS CLI)
atmos aws eks update-kubeconfig --profile=<profile> --name=<cluster_name>

# Using a named integration (no AWS CLI required)
atmos aws eks update-kubeconfig --integration=dev/eks/primary

# Using an identity with explicit parameters (no AWS CLI required)
atmos aws eks update-kubeconfig --name=dev-cluster --region=us-east-2 --identity=dev-admin

# Override parameters with component and stack
atmos aws eks update-kubeconfig <component> -s <stack> --kubeconfig=<path_to_kubeconfig> --region=<region>

# Additional options
atmos aws eks update-kubeconfig --role-arn <ARN>
atmos aws eks update-kubeconfig --alias <cluster context name alias>
atmos aws eks update-kubeconfig --dry-run=true
atmos aws eks update-kubeconfig --verbose=true

Arguments​

component (optional)
Atmos component.

Flags​

--stack / -s (optional)
Atmos stack.
--profile (optional)
AWS profile to use to authenticate to the EKS cluster.
--role-arn (optional)
AWS IAM role ARN to use to authenticate to the EKS cluster.
--name (optional)
EKS cluster name.
--region (optional)
AWS region.
--kubeconfig (optional)

kubeconfig filename to append with the configuration. Also bound to the KUBECONFIG and ATMOS_KUBECONFIG environment variables. When used with --integration, this overrides the integration's configured spec.cluster.kubeconfig.path. On the Go SDK paths (--integration and --identity), a leading ~ and environment variables ($VAR, ${VAR}) in the value are expanded.

--alias (optional)
Alias for the cluster context name. Defaults to match cluster ARN. On the Go SDK paths (--integration and --identity), when auth.realm (or ATMOS_AUTH_REALM) is set, the default is <realm>/<cluster ARN> (for example, acme/arn:aws:eks:us-east-1:111111111111:cluster/prod), so repositories with different realms keep separate contexts in a shared kubeconfig. The realm Atmos derives from the atmos.yaml path when neither is set does not change the name. An unprefixed context that an earlier version wrote for the same user is replaced. When used with --integration, this overrides the integration's configured spec.cluster.alias.
--dry-run (optional)
Show what would change without writing the kubeconfig. On the AWS CLI path, Atmos does not run aws eks update-kubeconfig. The Go SDK paths (--integration and --identity) print the cluster, context, and user entries that would be written to stdout (not the rest of the file), and authenticate without running the identity's auto-provisioned integrations, so a dry run performs no ECR login and writes no kubeconfig.
--verbose (optional)
Print more detailed output when writing the kubeconfig file, including the appended entries.
--integration (optional)

Name of a configured integration from auth.integrations (must be kind: aws/eks). When specified, Atmos authenticates the integration's linked identity and uses the Go SDK to describe the cluster and generate kubeconfig. This does not require the AWS CLI.

--identity (optional)

Atmos identity to authenticate with. When used with --name (and without --profile or --role-arn), Atmos authenticates via the auth system and uses the Go SDK directly. This does not require the AWS CLI.

Configuration​

Integration Mode​

EKS integrations are configured in atmos.yaml under auth.integrations:

auth:
providers:
company-sso:
kind: aws/iam-identity-center
region: us-east-1
start_url: https://company.awsapps.com/start/

identities:
dev-admin:
kind: aws/permission-set
via:
provider: company-sso
principal:
name: AdministratorAccess
account:
name: dev
integrations:
dev/eks/primary:
kind: aws/eks
via:
identity: dev-admin
spec:
cluster:
name: dev-cluster
region: us-east-2
alias: dev-eks
atmos aws eks update-kubeconfig --integration=dev/eks/primary
Overrides and path expansion

On the integration path, --kubeconfig and --alias override the integration's configured spec.cluster.kubeconfig.path and spec.cluster.alias for that run - useful for writing a per-cluster kubeconfig without editing the committed config.

On the Go SDK paths (--integration and --identity), both the --kubeconfig flag and the integration's spec.cluster.kubeconfig.path are expanded before use: a leading ~ (or ~/) resolves to the current user's home directory, and environment variables ($HOME, ${HOME}) are substituted. This keeps a committed, multi-developer integration config portable - for example, path: "${HOME}/.config/atmos/kube/qa" writes to each user's own home directory.

See the EKS Kubeconfig Authentication Tutorial for detailed configuration examples.

See Also​