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
    • Helm Chart
    • Isito-EnvoyFilter
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Vault
    • Longhorn – Storage
    • VictoriaMetrics
    • MetalLB
    • Kong Gateway
  • CI/CD
    • ArgoCD
    • ArgoWorkflows
    • Spinnaker
    • Jenkins
    • Harbor
    • TeamCity
    • Git
      • Bitbucket
  • Coding
    • Terraform
      • GCP – Google Cloud
      • AWS – Amazon Web Service
    • Golang
    • Laravel
    • Python
    • Jquery & JavaScript
    • Selenium
  • Log & Monitor
    • DataDog
    • Prometheus
    • Grafana
    • ELK
      • Kibana
      • Logstash
  • BareMetal
    • NextCloud
  • Toggle search form

[AWS] Provision AWS IAM Admin User as EKS Admin

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

Contents

  • 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

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
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

[eks] Kubernetes Cluster-AutoScaler error: Failed to watch *v1.CSIDriver AWS - Amazon Web Service
[AWS] Deploying Redis on AWS AWS - Amazon Web Service
[EKS/Terraform] Installing or Provisioning an EKS cluster through Terraform Module. AWS - Amazon Web Service
[Karpenter] Using Karpenter instead of Autoscaling Group. AWS - Amazon Web Service
[AWS] Discovering how to design Cluster Autoscaler on EKS. AWS - Amazon Web Service
[AWS] Login and get secret/token/credential of ECR 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

  • Experiences for IP Addresses Shortage on EKS Clusters March 29, 2023
  • [Talisman] Discover the sensitive information in your code. March 28, 2023
  • [Prometheus/Grafana] Install Prometheus and Grafana on ubuntu. March 27, 2023
  • [Kong Gateway] WebSocket connection failed March 26, 2023
  • [Nextcloud] Can’t download files to have a size bigger than 2Gi on NextCloud – RaspBerry March 24, 2023

Archives

  • 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
    • ArgoCD
    • ArgoWorkflows
    • Git
      • Bitbucket
    • Harbor
    • Jenkins
    • Spinnaker
    • TeamCity
  • Coding
    • Golang
    • Jquery & JavaScript
    • Laravel
    • Python
    • Selenium
    • Terraform
      • AWS – Amazon Web Service
      • GCP – Google Cloud
  • Kubernetes & Container
    • Apache Kafka
      • Kafka
      • Kafka Connect
      • Lenses
    • Docker
    • Helm Chart
    • Isito-EnvoyFilter
    • Kong Gateway
    • Kubernetes
      • Ingress
    • Longhorn – Storage
    • MetalLB
    • Vault
    • VictoriaMetrics
  • Log & Monitor
    • DataDog
    • ELK
      • Kibana
      • Logstash
    • Grafana
    • Prometheus
  • Uncategorized
  • Admin

Copyright © 2023 NimTechnology.