Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Call to aws cli to write kubeconfig file fails with RC 255 and output 'name' #7

@qdzlug

Description

@qdzlug

Describe the bug
The [start_all.sh](./kic-reference-architectures/pulumi/aws/start_all.sh ) script fails at the add_kube_config() function when the user has multiple k8 custom contexts. This fails on the CLI as well as in the script.

$ aws --profile f5 --region us-west-2 eks update-kubeconfig --name XXX
<- Snip ->
2021-06-23 13:17:12,792 - MainThread - botocore.retryhandler - DEBUG - No retry needed.
2021-06-23 13:17:12,829 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/awscli/clidriver.py", line 217, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "/usr/lib/python3/dist-packages/awscli/clidriver.py", line 358, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "/usr/lib/python3/dist-packages/awscli/customizations/commands.py", line 187, in __call__
    return self._run_main(parsed_args, parsed_globals)
  File "/usr/lib/python3/dist-packages/awscli/customizations/eks/update_kubeconfig.py", line 127, in _run_main
    config = config_selector.choose_kubeconfig(
  File "/usr/lib/python3/dist-packages/awscli/customizations/eks/update_kubeconfig.py", line 214, in choose_kubeconfig
    if loaded_config.has_cluster(cluster_name):
  File "/usr/lib/python3/dist-packages/awscli/customizations/eks/kubeconfig.py", line 67, in has_cluster
    return name in [cluster['name']
  File "/usr/lib/python3/dist-packages/awscli/customizations/eks/kubeconfig.py", line 67, in <listcomp>
    return name in [cluster['name']
KeyError: 'name'
2021-06-23 13:17:12,831 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

'name'

To Reproduce
Steps to reproduce the behavior:

  1. Create multiple contexts that are pointed to by the KUBECONFIG variable
  2. Attempt to update the kubeconfig using the aws eks update-kubeconfig command.
  3. The command will fail.
  4. Unset the KUBECONFIG variable.
  5. Re-run the command
  6. The command will succeed and write to the default KUBECONFIG (~/.kube/config)

Expected behavior
The information for the new cluster should be added to the currently active context file.

Your environment

  • Version of the repo: Commit 32f08f9
  • Version of KIC: 1.11.1
  • Version of infrastructure tooling: Pulumi
  • Version of executing environment: Python 3.8
  • OS and distribution: PopOS 20.10
  • Details about containerization or virtualization environment: Bare Metal install

Additional context
None

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions