Skip to content

NimTechnology

Trình bày các công nghệ CLOUD một cách dễ hiểu.

  • Kubernetes & Container
    • Docker
    • Kubernetes
      • Ingress
      • Pod
    • Helm Chart
    • OAuth2 Proxy
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Argo Events
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • DevSecOps
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
      • Azure Cloud
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log, Monitor & Tracing
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[AWS] Provision AWS IAM Admin User as EKS Admin

Posted on August 24, 2022January 9, 2025 By nim No Comments on [AWS] Provision AWS IAM Admin User as EKS Admin

Contents

Toggle
  • 1) Overall EKS IAM Introduction.
  • 2) Understand AWS EKS Authentication & Authorization
  • 3) Understand about EKS Cluster Creator User
  • 4) Introduction to Provisioning AWS Admin as EKS Admin
  • 5) Create IAM User and AWS CLI Profile
  • 6) Help Federated users can access EKS

1) Overall EKS IAM Introduction.

Đây là workflow khi bạn gõ kubectl và authen thông qua IAM của AWS
Cách nà chúng ta cung cấp 1 EKS admin
Bạn sẽ cần adjust configmap aws-auth
Nếu có nhiều User thì chẳng lẽ add từng user
Ook bạn sẽ tạo 1 group

2) Understand AWS EKS Authentication & Authorization

3) Understand about EKS Cluster Creator User

Đầu tiên bạn có thể sự 1 user có IAM Policy là Administrator Access
Để create 1 cluster EKS

4) Introduction to Provisioning AWS Admin as EKS Admin

Tiếp theo giờ bạn có 1 user eksadmin1 có quyền Administrator Access nhưng mà nó sẽ ko thể gõ kubeclt

bạn chỉ cần add user eksadmin1 trong configmap aws-auth
sau đó eksadmin1 có thể gõ kubectl

5) Create IAM User and AWS CLI Profile

Đầu tiên là mình đã tạo được 1 cluster eks
và mình gõ command tạo user eksadmin1

root@LP11-D7891:~# aws sts get-caller-identity
{
    "UserId": "AIDATU2QSHIISHPLW6PRV",
    "Account": "250887682577",
    "Arn": "arn:aws:iam::250887682577:user/nim"
}

Yeah! giờ tạo user

# Create IAM User
aws iam create-user --user-name eksadmin1

# Attach AdministratorAccess Policy to User
aws iam attach-user-policy --policy-arn arn:aws:iam::aws:policy/AdministratorAccess --user-name eksadmin1

# Set password for eksadmin1 user
aws iam create-login-profile --user-name eksadmin1 --password @EKSUser101 --no-password-reset-required

# Create Security Credentials for IAM User and make a note of them
aws iam create-access-key --user-name eksadmin1

# Make a note of Access Key ID and Secret Access Key
User: eksadmin1
{
    "AccessKey": {
        "UserName": "eksadmin1",
        "AccessKeyId": "AKIASUF7HC7SYK3RO727",
        "Status": "Active",
        "SecretAccessKey": "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",
        "CreateDate": "2022-03-20T03:19:02+00:00"
    }
}
# To list all configuration data
aws configure list

# To list all your profile names
aws configure list-profiles

# Configure aws cli eksadmin1 Profile 
aws configure --profile eksadmin1
AWS Access Key ID: AKIASUF7HC7SYK3RO727
AWS Secret Access Key: WQEf+lTcucoaKZt4EDnZmXm5VzqLkFLVWQaJxHiH
Default region: us-east-1
Default output format: json

# Get current user configured in AWS CLI
aws sts get-caller-identity
Observation: Should see the user "kalyandev" (EKS_Cluster_Create_User) from default profile
>>>>aws eks --region <region_name> update-kubeconfig --name <eks_cluster_name> --profile <profile_name>

root@LP11-D7891:~# aws eks --region us-east-1 update-kubeconfig --name SAP-dev-eksdemo --profile eksadmin1
Added new context arn:aws:eks:us-east-1:250887682577:cluster/SAP-dev-eksdemo to /root/.kube/config
Nếu bạn cat $HOME/.kube/config
Sẽ thấy có env kiểu như hình trên

Nếu bạn chưa config strong config map thì sẽ lỗi như bên dưới.

root@LP11-D7891:~# kubectl get node
error: You must be logged in to the server (Unauthorized)
Giờ bạn login vào console và đi vào cluster mà bạn mong muốn sẽ thấy thông báo trên

Giờ bạn cần thêm 1 config map trên EKS như anh dưới

Các bạn thêm như ảnh nhớ để ý chỗ ID nhé các bạn.
data:
  mapRoles: |
    - groups:
      - system:bootstrappers
      - system:nodes
      rolearn: arn:aws:iam::250887682577:role/SAP-dev-eks-nodegroup-role
      username: system:node:{{EC2PrivateDNSName}}
  mapUsers: |
    - userarn: arn:aws:iam::250887682577:user/eksadmin1
      username: eksadmin1
      groups:
        - system:masters 
binaryData: {}
Giờ user eksadmin1 đã get được node

6) Help Federated users can access EKS

thường chúng ta sẽ được đăng nhập vào AWS console như sau:

Bạn sẽ cần copy Federated users để sửa configmap: aws-auth trong kube-system namespace

Bạn add thêm Federated users follow theo ảnh trên

AWS - Amazon Web Service

Post navigation

Previous Post: [Ubuntu/NAT] Configure NAT on Ubuntu Server
Next Post: [Terraform ] Using Terragrunt to provision AWS base on Terraform Module

More Related Articles

[Terraform] – Terraform Beginner – Lesson 2: Working with Terraform. AWS - Amazon Web Service
[AWS] Using FSx Lustre to enhance disk performance for large-scale applications. AWS - Amazon Web Service
[aws] AWS refund AWS - Amazon Web Service
[CoreDNS] How to improve the Coredns performance. AWS - Amazon Web Service
[EKS windows] Using EKS terraform module to install K8S windows with manage node Group mode. AWS - Amazon Web Service
[EKS] operation error EKS: CreateAccessEntry, https response error StatusCode: 409 AWS - Amazon Web Service

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Tham Gia Group DevOps nhé!
Để Nim có nhiều động lực ra nhiều bài viết.
Để nhận được những thông báo mới nhất.

Recent Posts

  • [Azure/Loadbalancer] Creating an internal load balancer on Azure Kubernetes Service (AKS). May 13, 2025
  • [Azure] The subscription is not registered to use namespace ‘Microsoft.ContainerService’ May 8, 2025
  • [Azure] Insufficient regional vcpu quota left May 8, 2025
  • [WordPress] How to add a Dynamic watermark on WordPress. May 6, 2025
  • [vnet/Azure] VNet provisioning via Terraform. April 28, 2025

Archives

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021

Categories

  • BareMetal
    • NextCloud
  • CI/CD
    • Argo Events
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • DevSecOps
    • Golang
    • Jquery & JavaScript
    • Laravel
    • NextJS 14 & ReactJS & Type Script
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • Azure Cloud
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
      • Pod
    • Longhorn – Storage
    • MetalLB
    • OAuth2 Proxy
    • Vault
    • VictoriaMetrics
  • Log, Monitor & Tracing
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Fluent
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2025 NimTechnology.