Node Security
EKS node OS cluster की security posture का foundation है। Compromised node मतलब compromised cluster।
Bottlerocket OS
Bottlerocket Amazon का purpose-built container OS है। Node security में सबसे impactful single change।
Bottlerocket क्यों
| Feature | Amazon Linux 2 | Bottlerocket |
|---|---|---|
| Root filesystem | Read-write | Read-only (immutable) |
| SSH access | Default enabled | कोई SSH daemon नहीं |
| Package manager | yum | कोई नहीं |
| CIS Level 1 | Manual hardening ज़रूरी | Out of the box compliant |
| Update model | yum update | Atomic image-based updates |
| Shell access | Full bash | Admin container (auditable) |
कैसे Deploy करें
Managed Node Groups (Terraform) के साथ
resource "aws_eks_node_group" "main" {
# ...
ami_type = "BOTTLEROCKET_x86_64"
# ARM/Graviton के लिए:
# ami_type = "BOTTLEROCKET_ARM_64"
}
Karpenter के साथ
EC2NodeClass में Bottlerocket AMI family specify करो:
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
spec:
amiSelectorTerms:
- alias: bottlerocket@latest
blockDeviceMappings:
- deviceName: /dev/xvda
ebs:
volumeSize: 150Gi
volumeType: gp3
encrypted: true
Admin Access
Bottlerocket node debug करना हो तो SSM-based admin container इस्तेमाल करो:
aws ssm start-session --target i-0123456789abcdef0
यह logged और auditable है — SSH के विपरीत, जिसमें अक्सर कोई audit trail नहीं होता।
AMI Management
Production में AMI Versions Pin करो
Production node groups में latest AMIs इस्तेमाल मत करो। Specific AMI version pin करो और deliberately update करो:
amiSelectorTerms:
- alias: bottlerocket@v1.25.0
Upgrades में Refresh Strategy
EKS versions upgrade करते समय, nodes को नए AMIs चाहिए जो target version support करें:
- AMI selector को new version पर update करो
- पुराने nodes cordon करो
- Pods drain करो (PodDisruptionBudgets respect करते हुए)
- पुराने nodes terminate करो
- Karpenter या managed node group controller updated AMI के साथ नए nodes launch करता है
कभी SSH नहीं
EKS nodes पर SSH keys add मत करो। Debugging access चाहिए तो:
- SSM Session Manager: Interactive shell access, पूरी तरह CloudTrail में logged
kubectl debug: Running pods से attached ephemeral debug containerskubectl exec: Running container में direct shell access
SSH keys persistent credential हैं जो चुराई जा सकती हैं, share की जा सकती हैं, और बिना audit trails के इस्तेमाल हो सकती हैं। SSM उसकी replacement है।