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 [options]
This command downloads kubeconfig from an EKS cluster and saves it to a file. It supports multiple execution modes:
-
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.yamlCLI config and context.atmos aws eks update-kubeconfig --profile=<profile> --name=<cluster_name> -
Component and stack: If
componentandstackare provided on the command-line, then Atmos executes the command using theatmos.yamlCLI config and stack's context by searching for the following settings:components.helmfile.cluster_name_templatein theatmos.yamlCLI config (and calculates the--nameparameter using the Go template; the deprecatedcomponents.helmfile.cluster_name_patterntoken syntax also works)components.helmfile.helm_aws_profile_patternin theatmos.yamlCLI config (and calculates the--profileparameter using the pattern)components.helmfile.kubeconfig_pathin theatmos.yamlCLI config the variables for the component in the provided stackregionfrom the variables for the component in the stack
atmos aws eks update-kubeconfig <component> -s <stack> -
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 -
Integration mode: Use a named integration from
auth.integrationsto 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 -
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>
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
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)kubeconfigfilename to append with the configuration. Also bound to theKUBECONFIGandATMOS_KUBECONFIGenvironment variables. When used with--integration, this overrides the integration's configuredspec.cluster.kubeconfig.path. On the Go SDK paths (--integrationand--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 (
--integrationand--identity), whenauth.realm(orATMOS_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 theatmos.yamlpath 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 configuredspec.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 (--integrationand--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 bekind: 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--profileor--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
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
- AWS EKS Token Command - Generate EKS bearer tokens for kubectl
- EKS Kubeconfig Authentication Tutorial - Step-by-step EKS setup guide
- Auth Login Command - Authenticate with identities (triggers auto-provisioned integrations)