管理用于 EKS Kubernetes 集群的 AWS-auth 配置映射
The aws-auth utility and library makes the management of the aws-auth ConfigMap for EKS Kubernetes clusters easier and safer.
make bootstrapping a node group or removing/adding user access on EKS fast and easy
useful for automation purposes, any workflow that needs to grant IAM access to an EKS cluster can use this library to modify the config map.
run as part of a workflow on kubernetes using a docker image
The aws-auth tool is referenced in the AWS EKS best practices documentation here.
aws-auth includes both a CLI and a go library. You can install the CLI via go get or as a kubectl plugin via Krew or by downloading a binary from the releases page.
go get github.com/keikoproj/aws-auth
aws-auth helpAlternatively, install aws-auth with the krew plugin manager for kubectl.
kubectl krew install aws-auth
kubectl aws-authThe latest release artifacts can be downloaded from the GitHub releases page.
Or you can use the following command to download the latest release artifact for your platform:
curl -s https://api.github.com/repos/keikoproj/aws-auth/releases/latest
| grep "browser_download_url" \
| grep $(go env GOARCH) | grep $(go env GOOS) \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -Either download/install a released binary or add as a plugin to kubectl via Krew
…Given a config map with the following data:
…Remove all access belonging to an ARN (both mapUser roles will be removed)
$ aws-auth remove --mapusers --userarn arn:aws:iam::555555555555:user/a-user
removed arn:aws:iam::555555555555:user/a-user from aws-authRemove by full match (only mapUsers[0] will be removed)
$ aws-auth remove --mapusers --userarn arn:aws:iam::555555555555:user/a-user --username admin --groups system:masters
removed arn:aws:iam::555555555555:user/a-user from aws-authRemove based on a username
This command removes all map roles and map users that have matching input username. In the above configmap, map role for roleARN arn:aws:iam::555555555555:role/abc and mapUser for userARN arn:aws:iam::555555555555:user/a-user will be removed.
$ aws-auth remove-by-username --username ops-userBootstrap a new node group role
$ aws-auth upsert --maproles --rolearn arn:aws:iam::555555555555:role/my-new-node-group-NodeInstanceRole-74RF4UBDUKL6 --username system:node:{{EC2PrivateDNSName}} --groups system:bootstrappers system:nodes
added arn:aws:iam::555555555555:role/my-new-node-group-NodeInstanceRole-74RF4UBDUKL6 to aws-authYou can also add retries with exponential backoff
$ aws-auth upsert --maproles --rolearn arn:aws:iam::555555555555:role/my-new-node-group-NodeInstanceRole-74RF4UBDUKL6 --username system:node:{{EC2PrivateDNSName}} --groups system:bootstrappers system:nodes --retryRetries are configurable using the following flags
--retry Retry on failure with exponential backoff
--retry-max-count int Maximum number of retries before giving up (default 12)
--retry-max-time duration Maximum wait interval (default 30s)
--retry-min-time duration Minimum wait interval (default 200ms)Append groups to mapping instead of overwriting by using --append
$ aws-auth upsert --maproles --rolearn arn:aws:iam::00000000000:role/test --username test --groups test --appendAvoid overwriting username by using --update-username=false
$ aws-auth upsert --maproles --rolearn arn:aws:iam::00000000000:role/test --username test2 --groups test --update-username=falseUse the get command to get a detailed view of mappings
$ aws-auth get
TYPE ARN USERNAME GROUPS
Role Mapping arn:aws:iam::555555555555:role/my-new-node-group system:node:{{EC2PrivateDNSName}} system:bootstrappers, system:nodesuse impersonate
aws-auth get|update|remove --as --as-group …$ docker run \
-v ~/.kube/:/root/.kube/ \
-v ~/.aws/:/root/.aws/ \
keikoproj/aws-auth:latest \
aws-auth upsert --mapusers \
--userarn arn:aws:iam::555555555555:user/a-user \
--username admin \
--groups system:masters暂无开放 Issues,或尚未同步最近议题。