当前位置:网站首页>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
边栏推荐
- Set classic topics
- 229. 求众数 II
- Opencv -- yoact case segmentation model reasoning
- Common string processing functions in C language
- 520. Detect capital letters
- TreeSet after class exercises
- [BIM introduction practice] Revit building wall: detailed picture and text explanation of structure, envelope and lamination
- STM32 upper μ C / shell transplantation and Application
- 【BIM+GIS】ArcGIS Pro2. 8 how to open Revit model, Bim and GIS integration?
- 针对NFT的网络钓鱼
猜你喜欢

【BIM入门实战】Revit中的墙体层次以及常见问题解答

STM32单片机ADC规则组多通道转换-DMA模式

Gut liver axis: host microbiota interaction affects hepatocarcinogenesis

【论文阅读】【3d目标检测】Voxel Transformer for 3D Object Detection

Detailed explanation of life cycle component of jetpack

Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.

A new method for evaluating the quality of metagenome assembly - magista

无线充电全国产化电子元件推荐方案

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

HMS Core Discovery第14期回顾长文|纵享丝滑剪辑,释放视频创作力
随机推荐
[AI vision · quick review of robot papers today, issue 32] wed, 20 APR 2022
Installation of zynq platform cross compiler
win10, mysql-8.0.26-winx64.zip 安装
洛谷P1858 【多人背包】 (背包求前k优解)
IEEE Transactions on Systems, Man, and Cybernetics: Systems(TSMC)投稿须知
zynq平臺交叉編譯器的安裝
520.检测大写字母
php导出Excel表格
IDE Idea 自动编译 与 On Upate Action 、 On Frame Deactivation 的配置
matlab讀取多張fig圖然後合並為一張圖(子圖的形式)
MATLAB lit plusieurs diagrammes fig et les combine en un seul diagramme (sous forme de sous - Diagramme)
STM32上μC/Shell移植与应用
华为机试--高精度整数加法
基于英飞凌MCU GTM模块的无刷电机驱动方案开源啦
RC低通滤波器的逆系统
Thought of reducing Governance -- detailed summary of binary search
What is the thirty-six plan
阿里云IoT流转到postgresql数据库方案
小红书被曝整体裁员20%,大厂之间内卷也很严重
单极性非归零NRZ码、双极性非归零NRZ码、2ASK、2FSK、2PSK、2DPSK及MATLAB仿真