当前位置:网站首页>AWS eks add cluster user or Iam role
AWS eks add cluster user or Iam role
2022-04-23 04:33:00 【Heavy dust】
Catalog
Amazon EKS Use IAM by Kubernetes The cluster provides authentication ( adopt AWS CLI Of 1.16.156 Available in version or later aws eks get-token Order or Apply to Kubernetes Of AWS IAM Authenticators ), But it still depends on Kubernetes Role-based access control (RBAC) To authorize .

One 、 take aws-auth ConfigMap Apply to clusters
-
Check if you have applied
aws-authConfigMap.kubectl describe configmap -n kube-system aws-authIf you receive an error indication “
Error from server (NotFound): configmaps "aws-auth" not found”, Then continue with the following steps to apply inventory ConfigMap. -
download 、 Edit and apply AWS Authenticator configuration mapping .
-
Download configuration mapping .
curl -o aws-auth-cm.yaml https://s3.us-west-2.amazonaws.com/amazon-eks/cloudformation/2020-10-29/aws-auth-cm.yaml -
Open the file with your usual text editor . take
<ARN of instance role (not instance profile)>Replace with the... Associated with the node IAM Character's Amazon Resource Name (ARN), Then save the corresponding file . Do not modify any other lines in this file .important
role ARN Cannot contain path . role ARN The format of must be
arn:aws:iam::<123456789012>:role/<role-name>. For more information , see also aws-auth ConfigMap Do not grant access to the cluster .apiVersion: v1 kind: ConfigMap metadata: name: aws-auth namespace: kube-system data: mapRoles: | - rolearn: <ARN of instance role (not instance profile)> username: system:node:{ {EC2PrivateDNSName}} groups: - system:bootstrappers - system:nodesYou can check the status of the worker node group AWS CloudFormation Stack output , And find the following values :
- InstanceRoleARN( For used
eksctlCreate a new node group ) - NodeInstanceRole( For already in AWS Management Console Use in Amazon EKS Provided AWS CloudFormation Node group created by template )
- InstanceRoleARN( For used
-
Application configuration . This command may take several minutes to complete .
kubectl apply -f aws-auth-cm.yamlBe careful
If you receive any authorization or resource type error , See... In the troubleshooting section Unauthorized or access denied (kubectl).
-
-
Look at the status of the nodes and wait for them to reach
Readystate .kubectl get nodes --watch
Two 、 take IAM Add users or roles to Amazon EKS colony
-
Make sure AWS To be used
kubectlThe certificate has been authorized for the cluster . By default , Create the name of the cluster IAM Users have these permissions . -
open
aws-authConfigMap.kubectl edit -n kube-system configmap/aws-authBe careful
If you receive an error indication “
Error from server (NotFound): configmaps "aws-auth" not found”, Then use the above process to apply inventory ConfigMap.Example ConfigMap:
apiVersion: v1 data: mapRoles: | - groups: - system:bootstrappers - system:nodes rolearn: arn:aws:iam::111122223333:role/eksctl-my-cluster-nodegroup-standard-wo-NodeInstanceRole-1WP3NUE3O6UCF username: system:node:{ {EC2PrivateDNSName}} kind: ConfigMap metadata: creationTimestamp: "2020-09-30T21:09:18Z" name: aws-auth namespace: kube-system resourceVersion: "1021" selfLink: /api/v1/namespaces/kube-system/configmaps/aws-auth uid: dcc31de5-3838-11e8-af26-02e00430057c -
take IAM user 、 Role or AWS Add account to configMap. You can't put IAM Groups adding to configMap in .
- ** add to IAM role ( for example , about Federated users ):** Add role details to
dataNext ConfigMap OfmapRolespart . If this part does not exist in the file , Please add it . Each entry supports the following parameters :- rolearn: To add IAM Character's ARN.
- username:Kubernetes To map to IAM User name of the role .
- groups:Kubernetes List of groups to which the role in the is mapped . For more information , see also Kubernetes In document Default role and role binding .
- ** add to IAM user :** Add user details to
dataNext ConfigMap OfmapUserspart . If this part does not exist in the file , Please add it . Each entry supports the following parameters :- userarn: To add IAM User ARN.
- username:Kubernetes To map to IAM User name .
- groups:Kubernetes A list of groups to which users in the group are mapped . For more information , see also Kubernetes In document Default role and role binding .
for example , The following block contains :
mapRolespart , This section adds node instance roles , So that nodes can register themselves with the cluster .mapUserspart , It contains information from the default AWS account AWS useradminAnd from other AWS accountops-user. Both users are added tosystem:mastersGroup .
Will all
<example-values>( contain<>) Replace with your own value .# Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: v1 data: mapRoles: | - rolearn: <arn:aws:iam::111122223333:role/eksctl-my-cluster-nodegroup-standard-wo-NodeInstanceRole-1WP3NUE3O6UCF> username: <system:node:{ {EC2PrivateDNSName}}> groups: - <system:bootstrappers> - <system:nodes> mapUsers: | - userarn: <arn:aws:iam::111122223333:user/admin> username: <admin> groups: - <system:masters> - userarn: <arn:aws:iam::111122223333:user/ops-user> username: <ops-user> groups: - <system:masters> - ** add to IAM role ( for example , about Federated users ):** Add role details to
-
Save the file and exit your text editor .
-
Ensure that Kubernetes User or group ( Mapped IAM Users or roles ) Bind to with
RoleBindingorClusterRoleBindingOf Kubernetes role . For more information , see also Kubernetes In document Use RBAC to grant authorization . You can download the following sample listing , These lists createclusterroleandclusterrolebindingorroleandrolebinding:-
View all namespaces Kubernetes resources – The group name in the file is
eks-console-dashboard-full-access-group, Your IAM Users or roles need to be inaws-authconfigmap Map to this group in . if necessary , You can change the name of the group before applying it to the cluster , And then in configmap Take your IAM Users or roles are mapped to this group . Download the file from :https://s3.us-west-2.amazonaws.com/amazon-eks/docs/eks-console-full-access.yaml -
View... In a specific namespace Kubernetes resources – The namespace in this file is
default, therefore , If you want to specify a different namespace , Please edit this file , Then apply it to the cluster . The group name in the file iseks-console-dashboard-restricted-access-group, Your IAM Users or roles need to be inaws-authconfigmap Map to this group in . if necessary , You can change the name of the group before applying it to the cluster , And then in configmap Take your IAM Users or roles are mapped to this group . Download the file from :https://s3.us-west-2.amazonaws.com/amazon-eks/docs/eks-console-restricted-access.yaml
-
-
( Optional ) If you wish to have added to configmap Users in can be in AWS Management Console in Look at the node or View workload , Then the user or role must have the following two types of permissions :
- stay Kubernetes View resources in Kubernetes jurisdiction
- stay AWS Management Console View resources in IAM jurisdiction . For more information , see also stay AWS Management Console View the nodes and workloads of all clusters in .
版权声明
本文为[Heavy dust]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230413460108.html
边栏推荐
猜你喜欢

兼容NSR20F30NXT5G的小体积肖特基二极管

Supplément: annotation

【Echart】echart 入门

单片机串口数据处理(2)——uCOSIII+循环队列接收数据

/etc/bash_completion.d目录作用(用户登录立刻执行该目录下脚本)

Single chip microcomputer serial port data processing (2) -- ucosiii + cyclic queue receiving data

【论文阅读】【3d目标检测】Improving 3D Object Detection with Channel-wise Transformer

Qtspim manual - Chinese Translation

那些年我面试过的Android开发岗总结(附面试题+答案解析)
![[AI vision · quick review of NLP natural language processing papers today, No. 32] wed, 20 APR 2022](/img/b2/269ae2e9be269c2bff73eb1da5b55d.png)
[AI vision · quick review of NLP natural language processing papers today, No. 32] wed, 20 APR 2022
随机推荐
Fusobacterium -- symbiotic bacteria, opportunistic bacteria, oncobacterium
Single chip microcomputer serial port data processing (2) -- ucosiii + cyclic queue receiving data
383. 赎金信
Stm32f4 MCU ADC sampling and FFT of ARM-DSP Library
AWS EKS添加集群用户或IAM角色
协程与多进程的完美结合
MATLAB lit plusieurs diagrammes fig et les combine en un seul diagramme (sous forme de sous - Diagramme)
Bacterial infection and antibiotic use
Ali's ten-year technical experts jointly created the "latest" jetpack compose project combat drill (with demo)
Hard core chip removal
智能电子秤全国产化电子元件推荐方案
Redis command Encyclopedia
Installation and use of Apache bench (AB pressure test tool)
IDE idea automatic compilation and configuration of on update action and on frame deactivation
STM32 upper μ C / shell transplantation and Application
QtSpim手册-中文翻译
Mysql---数据读写分离、多实例
PHP export excel table
【测绘程序设计】坐标方位角推算神器(C#版)
RC低通滤波器的逆系统