Make env AWS_PROFILE optional on update-kubeconfig
Describe the feature
Since https://github.com/aws/aws-cli/pull/3683 when aws eks update-kubeconfig is run the current active profile (if any) is always included in kube config env section (AWS_PROFILE).
Wee should be able to disable this auto inclusion.
Use Case
We want to create Kubernetes config using an active profile but been able to use the same configuration with any other profile (without the need to reconfigure the kubernetes config).
If the kube config env section with the AWS_PROFILE is not set, the actual AWS_PROFILE is the currently active profile (if any) when a kubectl command is issued.
Proposed Solution
Add an option --include-profile
- true (default): works like now to keep compatibility (the current active profile, if any, is included in kube config env section)
- false: the env section with the profile information is not included (works like pre https://github.com/aws/aws-cli/pull/3683)
Other Information
For now, every time I want to use a different profile I have to update the Kubernetes config with aws eks update-kubeconfig and then use kubectl.
Alternatively I can manually edit .kube/config and comment the env parts (only once, but remember to do so every time I update the kube config) like so:
#env:
#- name: AWS_PROFILE
# value: profile
and I don't have to run aws eks update-kubeconfig every time I change the current profile.
Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
CLI version used
aws-cli/2.7.4
Environment details (OS name and version, etc.)
Ubuntu 22.04
Thanks @rubensa for the feature request. The EKS team owns this customization so I reached out to them regarding your request. I will update this issue when I hear back.
P67449827
As a side note: I also tried to use kubectl config unset command to "manually" remove the generated env part after issuing the aws eks update-kubeconfig command but couldn't find the right way to do it (see: https://discuss.kubernetes.io/t/kubectl-config-unset/20502)
I heard back from a member of the EKS team and they are willing to take this request into consideration during their roadmap planning. In the meantime we can leave this open for tracking, and we encourage others who are interested in this feature to 👍 the issue or leave a comment if they have additional use cases to share.
any update this issue? I also have same issue too.
because invalid env set profile, AWS_DEFAULT_PROFILE env does not work, so I manually edited config file by remove env value.
@tim-finnigan I've authored a PR (https://github.com/aws/aws-cli/pull/7845) to address this issue - please let the team know so they can review it. I am around to make any changes that they may request