(
props to :
IAM (International Association of Movers): What You Need to Know
for letting me use their logo..
well..
maybe they did..
I mean..
I wrote them an email..
well..
I have a plan to write them an email..
tomorrow..
….
maybe….
)
1. What is IAM and Why Is It Important?
Identity and Access Management (IAM) is a framework for managing permissions and authenticating identities in a system.
1.1 Why Use IAM Inside a Pod?
- π Control access to cloud services (AWS S3, GCP Storage, Azure Key Vault)
- π Enforce least privilege (only allow necessary permissions)
- π Secure API calls from applications running inside Kubernetes
- π Ensure compliance (GDPR, HIPAA, PCI DSS)
1.2 How IAM Works in Kubernetes
IAM inside a pod relies on cloud IAM policies and Kubernetes role-based access control (RBAC):
Feature | Description |
---|---|
Cloud IAM | Controls access to cloud services (AWS, GCP, Azure) |
Kubernetes RBAC | Controls access to Kubernetes resources |
Service Accounts | Allows pods to assume IAM roles |
OIDC & Workload Identity | Secure authentication inside clusters |
Now, letβs configure IAM inside Kubernetes pods.
2. Setting Up IAM in AWS (EKS) Inside a Pod
Step 1: Enable IAM Roles for Kubernetes Service Accounts
Ensure your AWS EKS cluster supports IAM roles for service accounts.
|
|
Step 2: Create an IAM Role for the Pod
Create an IAM policy:
|
|
Attach this policy to an IAM role:
|
|
Step 3: Associate IAM Role with a Kubernetes Service Account
|
|
Apply:
|
|
Step 4: Use IAM Role Inside a Pod
|
|
Verify IAM permissions:
|
|
Now, the pod can access AWS S3 securely without storing credentials. π
3. Setting Up IAM in GCP (GKE) Inside a Pod
Step 1: Enable Workload Identity
|
|
Step 2: Create a GCP IAM Service Account
|
|
Grant permissions:
|
|
Step 3: Associate IAM Role with a Kubernetes Service Account
|
|
Apply:
|
|
Step 4: Use IAM Role Inside a Pod
|
|
Verify IAM permissions:
|
|
Now, the pod can securely access GCP Storage without using service account keys. π
4. Setting Up IAM in Azure (AKS) Inside a Pod
Step 1: Enable Managed Identity for AKS
|
|
Step 2: Assign an IAM Role to the AKS Pod Identity
|
|
Grant permissions:
|
|
Step 3: Associate IAM Role with a Kubernetes Service Account
|
|
Apply:
|
|
Step 4: Use IAM Role Inside a Pod
|
|
Verify IAM permissions:
|
|
Now, the pod can access Azure services securely. π
5. Best Practices for IAM Inside Kubernetes Pods
β
Use IAM Roles instead of static credentials
β
Follow the Principle of Least Privilege (PoLP)
β
Use Kubernetes RBAC in combination with IAM
β
Rotate IAM credentials periodically
β
Monitor and audit IAM access logs
Key Ideas
β
IAM ensures secure access to cloud services without storing credentials
β
AWS (EKS), GCP (GKE), and Azure (AKS) all support pod IAM roles
β
Use Kubernetes Service Accounts to assume IAM roles securely
β
Follow best practices for securing IAM in Kubernetes