aws / aws/aws-cli

Make env AWS_PROFILE optional on update-kubeconfig

Open
#7,087 7 comments 12 reactions 0 assignees View on GitHub
customization eks-kubeconfig feature-request p2
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.