惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
罗磊的独立博客
H
Help Net Security
I
Intezer
G
Google Developers Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
Troy Hunt's Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
U
Unit 42
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
News and Events Feed by Topic
J
Java Code Geeks
S
Security Affairs
T
The Blog of Author Tim Ferriss
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Docker
The GitHub Blog
The GitHub Blog
F
Full Disclosure
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
S
Security @ Cisco Blogs
腾讯CDC
人人都是产品经理
人人都是产品经理
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
T
Threatpost
D
DataBreaches.Net
Recent Announcements
Recent Announcements
博客园 - 三生石上(FineUI控件)
MongoDB | Blog
MongoDB | Blog
博客园 - 【当耐特】
L
LINUX DO - 最新话题
Google Online Security Blog
Google Online Security Blog
S
Schneier on Security
S
Securelist
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Help Net Security
Help Net Security
P
Proofpoint News Feed
Project Zero
Project Zero
S
SegmentFault 最新的问题
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
Y
Y Combinator Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 叶小钗

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
🔐 Implementing Least‑Privilege Access in Amazon EKS Using Kubernetes RBAC
alok shankar · 2026-04-30 · via DEV Community

1. Introduction

As Kubernetes adoption grows across organizations, controlling who can do what inside a cluster becomes critical. In Amazon EKS, this challenge is compounded by the interaction between AWS IAM, EKS authentication, and Kubernetes RBAC.
In many teams, developers only need to deploy and update applications, but not manage cluster infrastructure or access sensitive data like secrets. Granting them full admin access increases risk and violates the principle of least privilege.
In this blog, i will walk through a real‑world, production‑ready RBAC implementation in Amazon EKS that allows a QA/deployment user to:

  • Update deployments
  • Monitor rollouts
  • Push images to ECR

…while explicitly restricting all administrative and destructive actions.

2. What is RBAC and Why Do We Need It?

RBAC (Role‑Based Access Control) is a Kubernetes authorization mechanism that controls who can access which resources and perform which actions inside a cluster.
RBAC answers three key questions:

  1. Who is the user or service?
  2. What Kubernetes resources can they access?
  3. Which actions (verbs) can they perform on those resources?

Without RBAC:

  • Every authenticated user may become a de facto admin
  • Accidental deletes can take down environments
  • Auditing and compliance become difficult RBAC provides fine‑grained, auditable, and secure access control.
  1. Benefits of RBAC Implementing RBAC provides several tangible benefits:

Least Privilege – users get only what they need
Blast Radius Reduction – mistakes don’t bring down clusters
Security Compliance – aligns with SOC2, ISO, PCI controls
Clear Separation of Duties – infra vs application teams
Auditable Access – easy to review who can do what

  1. Prerequisites Before starting, ensure the following are in place:

✅ Amazon EKS cluster (Test/QA environment)
✅ Admin access to the EKS cluster
✅ AWS CLI and kubectl configured
✅ An IAM user for deployment (example: web_deploy_qa)
✅ ECR repository for application images

5. Step‑by‑Step Implementation

5.1 Create IAM Policy for Deployment User
This policy allows:

  • ECR push
  • EKS cluster discovery

Why needed
Without this, the user cannot:

  • authenticate to EKS
  • push images during deployments

IAM Policy (web-deploy-policy-qa)

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ecr:GetAuthorizationToken",
      "Resource": "*"
    },
    {
      "Effect": "Allow",
      "Action": [
        "ecr:BatchCheckLayerAvailability",
        "ecr:InitiateLayerUpload",
        "ecr:UploadLayerPart",
        "ecr:CompleteLayerUpload",
        "ecr:PutImage"
      ],
      "Resource": "arn:aws:ecr:us-west-2:xxxxxxxxxxxx:repository/web-qa-ecr"
    },
    {
      "Effect": "Allow",
      "Action": "eks:DescribeCluster",
      "Resource": "arn:aws:eks:us-west-2:xxxxxxxxxxxx:cluster/web-qa-eks"
    }
  ]
}

Enter fullscreen mode Exit fullscreen mode

Attach this policy to IAM user web_deploy_qa.

5.2 (Modern EKS) Create EKS Access Entry
Newer EKS clusters use EKS Access Management.

Why needed
In new EKS clusters, aws-auth alone is not enough—Access Entries are mandatory.
✅ Without this step, users get Unauthorized even with correct RBAC.

aws eks create-access-entry \
  --cluster-name web-qa-eks \
  --principal-arn arn:aws:iam::xxxxxxxxxxx:user/web_deploy_qa \
  --region us-west-2

Enter fullscreen mode Exit fullscreen mode

Output:

{
  "accessEntry": {
    "principalArn": "arn:aws:iam::xxxxxxxxxx:user/web_deploy_qa",
    "type": "STANDARD"
  }
}

Enter fullscreen mode Exit fullscreen mode

[ec2-user@ip-xxxxxxxxxxxx xxxxxxxxxxxx]$ aws eks create-access-entry \
  --cluster-name web-qa-eks \
  --principal-arn arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa \
  --region us-west-2
{
    "accessEntry": {
        "clusterName": "web-qa-eks",
        "principalArn": "arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa",
        "kubernetesGroups": [],
        "accessEntryArn": "arn:aws:eks:us-west-2:xxxxxxxxxxxx:access-entry/web-qa-eks/user/xxxxxxxxxxxx/web_deploy_qa/3acedc95-6cab-f7fd-bd78-d84fdac46546",
        "createdAt": "2026-01-23T07:08:06.401000+00:00",
        "modifiedAt": "2026-01-23T07:08:06.401000+00:00",
        "tags": {},
        "username": "arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa",
        "type": "STANDARD"
    }
}

Enter fullscreen mode Exit fullscreen mode

5.3 Associate EKS View Policy (Required for kubectl discovery)

This allows read‑only cluster discovery (namespaces, API resources).
Why needed
kubectl requires read‑only discovery access.

aws eks associate-access-policy \
  --cluster-name web-qa-eks \
  --principal-arn arn:aws:iam::xxxxxxxxxxxxx:user/web_deploy_qa \
  --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy \
  --access-scope type=cluster \
  --region us-west-2

Enter fullscreen mode Exit fullscreen mode

[ec2-user@ip-xxxxxxxxxxxx ]$ aws eks associate-access-policy \
  --cluster-name web-qa-eks \
  --principal-arn arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa \
  --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy \
  --access-scope type=cluster \
  --region us-west-2
{
    "clusterName": "web-qa-eks",
    "principalArn": "arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa",
    "associatedAccessPolicy": {
        "policyArn": "arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy",
        "accessScope": {
            "type": "cluster",
            "namespaces": []
        },
        "associatedAt": "2026-01-23T07:08:59.134000+00:00",
        "modifiedAt": "2026-01-23T07:08:59.134000+00:00"
    }
}

Enter fullscreen mode Exit fullscreen mode

✅ This does NOT grant admin rights.

5.4 Create ClusterRole (Deployment Only)
Why needed
Defines what actions are allowed.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: qa-deployment-clusterrole
rules:
  - apiGroups: ["apps"]
    resources: ["deployments"]
    verbs:
      - get
      - list
      - watch
      - patch
      - update

  - apiGroups: ["apps"]
    resources: ["deployments/status", "replicasets"]
    verbs:
      - get
      - list
      - watch

Enter fullscreen mode Exit fullscreen mode

[ec2-user@ip-xxxxxxxxxxxx xxxxxxxxxxxx]$ cat <<EOF > qa-deployment-clusterrole.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: qa-deployment-clusterrole
rules:
  - apiGroups: ["apps"]
    resources: ["deployments"]
    verbs: ["get", "patch", "update"]

  - apiGroups: ["apps"]
    resources: ["deployments/status", "replicasets"]
    verbs: ["get", "list", "watch"]
EOF
[ec2-user@ip-xxxxxxxxxxxx xxxxxxxxxxxx]$ ll
total 8
-rw-r--r--. 1 ec2-user ec2-user 317 March 23 05:58 qa-deployment-clusterrole.yaml
[ec2-user@ip-xxxxxxxxxxxx xxxxxxxxxxxx]$ kubectl apply -f qa-deployment-clusterrole.yaml
clusterrole.rbac.authorization.k8s.io/qa-deployment-clusterrole created

Enter fullscreen mode Exit fullscreen mode

Verification -

[ec2-user@ip-xxxxxxxxxxxx xxxxxxxxxxxx]$ kubectl get clusterrole qa-deployment-clusterrole
kubectl get clusterrolebinding qa-deployment-clusterbinding
NAME                        CREATED AT
qa-deployment-clusterrole   2026-03-23T05:58:46Z
NAME                           ROLE                                    AGE
qa-deployment-clusterbinding   ClusterRole/qa-deployment-clusterrole   15s

Enter fullscreen mode Exit fullscreen mode

5.5 Map IAM User in aws-auth ConfigMap
Why needed
This bridges AWS IAM → Kubernetes identity.

mapUsers: |
  - userarn: arn:aws:iam::xxxxxxxxxxxxx:user/web_deploy_qa
    username: arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa
    groups:
      - qa-deployers
``

Enter fullscreen mode Exit fullscreen mode

✅ Proper indentation is critical for EKS authentication.

[ec2-user@xxxxxxxxxxxxxx]$ cat <<EOF > aws-auth-fixed.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: aws-auth
  namespace: kube-system
data:
  mapRoles: |
    - rolearn: arn:aws:iam::xxxxxxxxxxxx:role/EKS-EC2-Role
      username: eks-ec2-role
      groups:
        - system:masters

  mapUsers: |
    - userarn: arn:aws:iam::xxxxxxxxxxxx:user/devops-admin
      username: devops-admin
      groups:
        - system:masters

    - userarn: arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa
      username: web_deploy_qa
      groups:
        - qa-deployers
EOF
[ec2-user@xxxxxxxxxxxxx]$ ll
total 16
-rw-r--r--. 1 ec2-user ec2-user 518 Apr 23 06:43 aws-auth-fixed.yaml
-rw-r--r--. 1 ec2-user ec2-user 303 Apr 23 05:59 qa-deployment-clusterbinding.yaml
-rw-r--r--. 1 ec2-user ec2-user 317 Apr 23 05:58 qa-deployment-clusterrole.yaml
[ec2-user@xxxxxxxxxxxx]$ kubectl apply -f aws-auth-fixed.yaml
Warning: resource configmaps/aws-auth is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically.
configmap/aws-auth configured
[ec2-user@xxxxxxxxxxxxxxxxxxx]$

Enter fullscreen mode Exit fullscreen mode

Verification -

[ec2-user@xxxxxxxxxxxxxxxxxxxxxxx]$ kubectl get configmap aws-auth -n kube-system -o yaml
apiVersion: v1
data:
  mapRoles: |
    - rolearn: arn:aws:iam::xxxxxxxxxxxx:role/EKS-EC2-Role
      username: eks-ec2-role
      groups:
        - system:masters
  mapUsers: |
    - userarn: arn:aws:iam::xxxxxxxxxxxx:user/devops-admin
      username: devops-admin
      groups:
        - system:masters

    - userarn: arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa
      username: web-deploy-qa
      groups:
        - qa-deployers
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"mapRoles":"- rolearn: arn:aws:iam::xxxxxxxxxxxx:role/EKS-EC2-Role\n  username: eks-admin-ec2-role\n  groups:\n    - system:masters\n","mapUsers":"- userarn: arn:aws:iam::xxxxxxxxxxxx:user/devops-admin\n  username: devops-admin\n  groups:\n    - system:masters\n\n- userarn: arn:aws:iam::xxxxxxxxxxxx:user/web_deploy_qa\n  username: web-deploy-qa\n  groups:\n    - qa-deployers\n"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"aws-auth","namespace":"kube-system"}}
  creationTimestamp: "2026-04-13T07:07:43Z"
  name: aws-auth
  namespace: kube-system
  resourceVersion: "4329198"
  uid: 5bda06d5-f977-4c52-b3d2-556bdd8f5da1

Enter fullscreen mode Exit fullscreen mode

6️⃣ Architecture – Before RBAC

IAM User


aws-auth (system:masters)


FULL CLUSTER ADMIN ACCESS ❌

Before RBAC Problems:

  1. ❌ Users often had system:masters
  2. ❌ Full cluster admin access
  3. ❌ Could delete namespaces, secrets, workloads
  4. ❌ High risk of accidental outages

7️⃣ Final Architecture -After RBAC

IAM User (web_deploy_qa)
   ↓
EKS Access Entry (STANDARD)
   ↓
AmazonEKSViewPolicy (discovery only)
   ↓
Kubernetes ClusterRole + ClusterRoleBinding
   ↓
Controlled deployment updates

Enter fullscreen mode Exit fullscreen mode

✅ Result

  1. Authentication ✅
  2. Discovery ✅
  3. Controlled mutations ✅
  4. Admin access ❌

8️⃣ Validation Before Handover

  1. Configure aws IAM user in bastion server-
[ec2-user@xxxxxxxxxxx ~]$ aws configure --profile web_deploy_qa
AWS Access Key ID [None]: xxxxxxxxxxxxxxxx
AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Default region name [None]: xxxxxxxxxxxx
Default output format [None]: json
[ec2-user@xxxxxxxxxxxx ~]$ aws sts get-caller-identity --profile web_deploy_qa
{
    "UserId": "xxxxxxxxxxxxxx",
    "Account": "xxxxxxxxxxxxx",
    "Arn": "arn:aws:iam::xxxxxxxxxxxxx:user/web_deploy_qa"
}

Enter fullscreen mode Exit fullscreen mode

  1. Update EKS kubeconfig to add profile web_deploy_qa
[ec2-user@xxxxxxxxxxxxxxxxxxx]$ aws eks update-kubeconfig \
  --region us-west-2 \
  --name web-qa-eks \
  --profile web_deploy_qa \
  --alias web-deploy-eks-qa
Updated context web-deploy-eks-qa in /home/ec2-user/.kube/config

Enter fullscreen mode Exit fullscreen mode

  1. Switch to QA context.

[ec2-user@xxxxxxxxxxxxxxxxxxxxx]$ kubectl config use-context web-deploy-eks-qa
Switched to context "web-deploy-eks-qa".
[ec2-user@xxxxxxxxxxxxxxxxxxxxx]$ 

Enter fullscreen mode Exit fullscreen mode

4.Verify identity:

[ec2-user@xxxxxxxxxxxxxxxxxxxxxxxxxxx]$ kubectl auth whoami
ATTRIBUTE                                              VALUE
Username                                               arn:aws:iam::xxxxxxxxxxxxx:user/web_deploy_qa
UID                                                    aws-iam-authenticator:xxxxxxxxxxxxx:xxxxxxxxxxxxx
Groups                                                 [system:authenticated]
Extra: accessKeyId                                     [xxxxxxxxxxxxx]
Extra: arn                                             [arn:aws:iam::xxxxxxxxxxxxx:user/web_deploy_qa]
Extra: canonicalArn                                    [arn:aws:iam::xxxxxxxxxxxxx:user/web_deploy_qa]
Extra: principalId                                     [xxxxxxxxxxxxx]
Extra: sessionName                                     []
Extra: sigs.k8s.io/aws-iam-authenticator/principalId   [xxxxxxxxxxxxx]

Enter fullscreen mode Exit fullscreen mode

9️⃣ Validation Checklist (Commands)
✅ Allowed

kubectl auth can-i patch deployments --all-namespaces
kubectl auth can-i update deployments --all-namespaces
kubectl auth can-i watch replicasets --all-namespaces
kubectl auth can-i get deployments --all-namespaces

Enter fullscreen mode Exit fullscreen mode

OutPut :

[ec2-user@xxxxxxxxxxxxxx]$ kubectl auth can-i patch deployments --all-namespaces
yes
[ec2-user@xxxxxxxxxxxxxx]$ kubectl auth can-i update deployments --all-namespaces
yes
[ec2-user@xxxxxxxxxxxxxx]$ kubectl auth can-i watch replicasets --all-namespaces
kubectl auth can-i get deployments --all-namespaces
yes
yes

Enter fullscreen mode Exit fullscreen mode

❌ Restricted

kubectl auth can-i delete deployments --all-namespaces
kubectl auth can-i get secrets --all-namespaces
kubectl auth can-i exec pods --all-namespaces
kubectl auth can-i update configmap aws-auth -n kube-system

Enter fullscreen mode Exit fullscreen mode

[ec2-user@xxxxxxxxxxxxxx]$ kubectl auth can-i delete deployments --all-namespaces
kubectl auth can-i create deployments --all-namespaces
kubectl auth can-i get secrets --all-namespaces
kubectl auth can-i exec pods --all-namespaces
no
no
no
no

Enter fullscreen mode Exit fullscreen mode

🔧 Troubleshooting Section
❌ Unauthorized Error
Cause:

  • Missing EKS Access Entry
  • Checking access entry and add it if required
[ec2-user@xxxxxxxxxxxxxx]$ aws eks list-access-entries --cluster-name web-qa-eks --region us-west-2           {
    "accessEntries": [
        "arn:aws:iam::xxxxxxxxxxxxxx:role/EKS-EC2-Role",
        "arn:aws:iam::xxxxxxxxxxxxxx:role/aws-service-role/eks.amazonaws.com/AWSServiceRoleForAmazonEKS",
        "arn:aws:iam::xxxxxxxxxxxxxx:user/devops_admin",
        "arn:aws:iam::xxxxxxxxxxxxxx:user/web_deploy_qa"
    ]
}

Enter fullscreen mode Exit fullscreen mode

❌ aws-auth Looks Correct but Still Fails
Cause:
aws-node cache

Fix:

kubectl rollout restart daemonset aws-node -n kube-system

Enter fullscreen mode Exit fullscreen mode

[ec2-user@xxxxxxxxxxxxxx]$ kubectl rollout restart daemonset aws-node -n kube-system
daemonset.apps/aws-node restarted

Enter fullscreen mode Exit fullscreen mode

❌ Can Get But Cannot Patch Deployments
Cause:
ClusterRoleBinding subject mismatch
Check:

kubectl auth whoami
kubectl get clusterrolebinding -o yaml

Enter fullscreen mode Exit fullscreen mode

[ec2-user@xxxxxxxxxxxxxx]$ kubectl auth whoami
ATTRIBUTE                                              VALUE
Username                                               arn:aws:iam::xxxxxxxxxxxxxx:user/web_deploy_qa
UID                                                    aws-iam-authenticator:xxxxxxxxxxxxxx:AIDA3TR7NTEIQMP4HFBAZ
Groups                                                 [system:authenticated]
Extra: accessKeyId                                     [xxxxxxxxxxxxxxxxxxxxx]
Extra: arn                                             [arn:aws:iam::xxxxxxxxxxxxxx:user/web_deploy_qa]
Extra: canonicalArn                                    [arn:aws:iam::xxxxxxxxxxxxxx:user/web_deploy_qa]
Extra: principalId                                     [xxxxxxxxxxxxxxx]
Extra: sessionName                                     []
Extra: sigs.k8s.io/aws-iam-authenticator/principalId   [AIDA3TR7NTEIQMP4HFBAZ]
[ec2-user@xxxxxxxxxxxxxxx]$ kubectl patch clusterrolebinding qa-deployment-clusterbinding \
  --type='json' \
  -p='[{"op":"replace","path":"/subjects/0/name","value":"arn:aws:iam::xxxxxxxxxxxxxxxxxxxxx:user/web_deploy_qa"}]'
clusterrolebinding.rbac.authorization.k8s.io/qa-deployment-clusterbinding patched

Enter fullscreen mode Exit fullscreen mode

10. Conclusion
By combining:

✅ IAM policies
✅ EKS Access Entries
✅ AmazonEKSViewPolicy
✅ Kubernetes RBAC

we achieved a secure, least‑privilege, production‑grade access model for application deployment teams.
This approach:

  1. Prevents privilege escalation
  2. Protects cluster stability
  3. Provides a clean operational boundary between infra and dev teams

RBAC is not optional in Kubernetes — it is foundational.
When implemented correctly in EKS, it enables safe scaling of teams without sacrificing security or control.

Happy Orchestrating & Bulletproof K8s! 🛠️

Follow me on LinkedIn: www.linkedin.com/in/alok-shankar-55b94826