Skip to content

Commit 4ba7a97

Browse files
committed
Doc updates for aws iam auth addition and removal
1 parent 13cb4a5 commit 4ba7a97

File tree

1 file changed

+98
-12
lines changed

1 file changed

+98
-12
lines changed

docs/content/en/docs/clustermgmt/security/cluster-iam-auth.md

Lines changed: 98 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@ description: >
1313

1414
EKS Anywhere supports configuring [AWS IAM Authenticator](https://github.com/kubernetes-sigs/aws-iam-authenticator) as an authentication provider for clusters.
1515

16-
When you create a cluster with IAM Authenticator enabled, EKS Anywhere
16+
When you enable IAM Authenticator on a cluster, EKS Anywhere
1717
* Installs `aws-iam-authenticator` server as a DaemonSet on the workload cluster.
1818
* Configures the Kubernetes API Server to communicate with iam authenticator using a [token authentication webhook](https://kubernetes.io/docs/admin/authentication/#webhook-token-authentication).
1919
* Creates the necessary ConfigMaps based on user options.
2020

21-
{{% alert title="Note" color="primary" %}}
22-
Enabling IAM Authenticator needs to be done during cluster creation.
23-
{{% /alert %}}
2421

2522
### Create IAM Authenticator enabled cluster
2623
Generate your cluster configuration and add the necessary IAM Authenticator configuration. For a full spec reference check [AWSIamConfig]({{< relref "../../getting-started/optional/iamauth" >}}).
@@ -104,10 +101,94 @@ ${PWD}/${CLUSTER_NAME}/${CLUSTER_NAME}-aws.kubeconfig
104101
kubectl get pods -A
105102
```
106103

107-
### Modify IAM Authenticator mappings
108-
EKS Anywhere supports modifying IAM ARNs that are mapped on the cluster. The mappings can be modified by either running the `upgrade cluster` command or using `GitOps`.
104+
### Managing AWS IAM Authenticator
105+
EKS Anywhere supports adding, removing, and modifying AWS IAM Authenticator configuration on existing clusters. These operations can be performed using the `upgrade cluster` command or `GitOps`.
106+
107+
### Add AWS IAM Authenticator to existing cluster
108+
You can add AWS IAM Authenticator to an existing cluster that was created without it.
109+
110+
1. Add the `identityProviderRefs` section to your cluster configuration and create the `AWSIamConfig` resource:
111+
112+
```yaml
113+
apiVersion: anywhere.eks.amazonaws.com/v1alpha1
114+
kind: Cluster
115+
metadata:
116+
name: my-cluster-name
117+
spec:
118+
...
119+
# Add IAM Authenticator to existing cluster
120+
identityProviderRefs:
121+
- kind: AWSIamConfig
122+
name: aws-iam-auth-config
123+
---
124+
apiVersion: anywhere.eks.amazonaws.com/v1alpha1
125+
kind: AWSIamConfig
126+
metadata:
127+
name: aws-iam-auth-config
128+
spec:
129+
awsRegion: us-west-1
130+
backendMode:
131+
- EKSConfigMap
132+
mapRoles:
133+
- roleARN: arn:aws:iam::XXXXXXXXXXXX:role/myRole
134+
username: myKubernetesUsername
135+
groups:
136+
- system:masters
137+
mapUsers:
138+
- userARN: arn:aws:iam::XXXXXXXXXXXX:user/myUser
139+
username: myKubernetesUsername
140+
groups:
141+
- system:masters
142+
partition: aws
143+
```
144+
145+
2. Run the upgrade command:
146+
```bash
147+
CLUSTER_NAME=my-cluster-name
148+
eksctl anywhere upgrade cluster -f ${CLUSTER_NAME}.yaml
149+
```
150+
151+
EKS Anywhere will:
152+
* Install the `aws-iam-authenticator` server on the workload cluster
153+
* Configure the Kubernetes API Server with the authentication webhook
154+
* Create the necessary ConfigMaps
155+
* Generate the AWS IAM-based kubeconfig file at `${PWD}/${CLUSTER_NAME}/${CLUSTER_NAME}-aws.kubeconfig`
156+
157+
### Remove AWS IAM Authenticator from cluster
158+
You can remove AWS IAM Authenticator from a cluster that has it enabled.
159+
160+
1. Remove the `identityProviderRefs` section from your cluster configuration:
161+
162+
```yaml
163+
apiVersion: anywhere.eks.amazonaws.com/v1alpha1
164+
kind: Cluster
165+
metadata:
166+
name: my-cluster-name
167+
spec:
168+
...
169+
# Remove this section to disable IAM Authenticator
170+
# identityProviderRefs:
171+
# - kind: AWSIamConfig
172+
# name: aws-iam-auth-config
173+
```
174+
175+
2. Run the upgrade command:
176+
```bash
177+
CLUSTER_NAME=my-cluster-name
178+
eksctl anywhere upgrade cluster -f ${CLUSTER_NAME}.yaml
179+
```
180+
181+
EKS Anywhere will:
182+
* Remove the `aws-iam-authenticator` server from the workload cluster
183+
* Clean up the authentication webhook configuration
184+
* Remove ConfigMaps and other related resources
185+
* Clean up the AWS IAM-based kubeconfig file
109186

110-
#### upgrade command
187+
{{% alert title="Warning" color="warning" %}}
188+
After removing AWS IAM Authenticator, users will no longer be able to authenticate using the AWS IAM-based kubeconfig file. Ensure you have alternative authentication methods configured before removing IAM Authenticator.
189+
{{% /alert %}}
190+
191+
### Modify IAM Authenticator mappings
111192
The `mapRoles` and `mapUsers` lists in `AWSIamConfig` can be modified when running the `upgrade cluster` command from EKS Anywhere.
112193

113194
As an example, let's add another IAM user to the above example configuration.
@@ -132,10 +213,10 @@ and then run the upgrade command
132213
CLUSTER_NAME=my-cluster-name
133214
eksctl anywhere upgrade cluster -f ${CLUSTER_NAME}.yaml
134215
```
135-
EKS Anywhere now updates the role mappings for IAM authenticator in the cluster and a new user gains access to the cluster.
216+
EKS Anywhere now updates the role mappings for IAM authenticator in the cluster and the new user gains access to the cluster.
136217

137218
#### GitOps
138-
If the cluster created has GitOps configured, then the `mapRoles` and `mapUsers` list in `AWSIamConfig` can be modified by the GitOps controller. For GitOps configuration details refer to [Manage Cluster with GitOps]({{< relref "../../clustermgmt/cluster-flux" >}}).
219+
If the cluster has GitOps configured, then AWS IAM Authenticator can be added, removed, or modified by the GitOps controller. For GitOps configuration details refer to [Manage Cluster with GitOps]({{< relref "../../clustermgmt/cluster-flux" >}}).
139220

140221
{{% alert title="Note" color="primary" %}}
141222
GitOps support for the `AWSIamConfig` is currently only on management or self-managed clusters.
@@ -146,11 +227,16 @@ GitOps support for the `AWSIamConfig` is currently only on management or self-ma
146227
```
147228
clusters/$CLUSTER_NAME/eksa-system/eksa-cluster.yaml
148229
```
149-
2. Modify the `AWSIamConfig` object and add to the `mapRoles` and `mapUsers` object lists.
230+
2. To **add** AWS IAM Authenticator: Add the `identityProviderRefs` section and `AWSIamConfig` resource to the cluster specification.
231+
232+
To **remove** AWS IAM Authenticator: Remove the `identityProviderRefs` section from the cluster specification.
233+
234+
To **modify** mappings: Update the `mapRoles` and `mapUsers` lists in the `AWSIamConfig` object.
235+
150236
3. Commit the file to your git repository
151237
```bash
152238
git add eksa-cluster.yaml
153-
git commit -m 'Adding IAM Authenticator access ARNs'
239+
git commit -m 'Update IAM Authenticator configuration'
154240
git push origin main
155241
```
156-
EKS Anywhere GitOps Controller now updates the role mappings for IAM authenticator in the cluster and users gains access to the cluster.
242+
EKS Anywhere GitOps Controller will apply the changes to the cluster, adding, removing, or updating the IAM authenticator configuration as specified.

0 commit comments

Comments
 (0)