EKS Storage Part 3 Quiz
This quiz tests your understanding of storage monitoring, troubleshooting, cost optimization, and security in Amazon EKS.
Question 1: Storage Monitoring Metrics
What are the key metrics for monitoring storage performance in EKS?
Answer:EBS Metrics:
- VolumeReadOps/VolumeWriteOps: IOPS usage
- VolumeReadBytes/VolumeWriteBytes: Throughput
- VolumeTotalReadTime/VolumeTotalWriteTime: Latency
- VolumeQueueLength: Number of pending I/O requests
- BurstBalance: Burst credit balance
EFS Metrics:
- DataReadIOBytes/DataWriteIOBytes: Data transfer volume
- MetadataIOBytes: Metadata operation volume
- ClientConnections: Number of client connections
- PercentIOLimit: I/O limit utilization
Kubernetes Metrics:
- kubelet_volume_stats_used_bytes: Volume usage
- kubelet_volume_stats_capacity_bytes: Volume capacity
- container_fs_usage_bytes: Container filesystem usage
Question 2: Storage Problem Diagnosis
What should you check when a pod in EKS is stuck in "Pending" state and cannot mount a PVC?
Answer:
Check PVC Status:
bashkubectl get pvc kubectl describe pvc <pvc-name>Check Storage Class:
bashkubectl get storageclass kubectl describe storageclass <storage-class-name>Check CSI Driver Status:
bashkubectl get pods -n kube-system -l app=ebs-csi-controller kubectl logs -n kube-system -l app=ebs-csi-controllerCheck Node Permissions:
- Verify required IAM permissions in EC2 instance profile
- Verify EBS CSI driver service account permissions
Availability Zone Compatibility:
- Verify pod and EBS volume are in the same AZ
Resource Limits:
- EBS volume limits (maximum volumes per instance)
- Verify volume size limits
Question 3: Performance Optimization
How can you optimize storage performance for database workloads in EKS?
Answer:
Select Appropriate Volume Type:
yamlapiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast-ssd provisioner: ebs.csi.aws.com parameters: type: io2 iops: "10000" encrypted: "true" volumeBindingMode: WaitForFirstConsumerUse Multi-Attach Volumes (for read-only workloads):
yamlparameters: type: io2 multiAttach: "true"Utilize Instance Store:
yaml# Instance store for temporary data volumeMounts: - name: instance-store mountPath: /tmp volumes: - name: instance-store hostPath: path: /mnt/instance-storeSelect Appropriate Filesystem:
- XFS: Large files and high concurrency
- ext4: General purpose
- Set appropriate mount options
I/O Scheduler Optimization:
bash# noop or deadline scheduler for SSD echo noop > /sys/block/nvme0n1/queue/scheduler
Question 4: Cost Optimization Strategies
What strategies can be used to optimize EKS storage costs?
Answer:
Select Appropriate Volume Type:
- gp3: Cost-effective for most workloads
- Migrate from gp2 to gp3
- Use provisioned IOPS only when necessary
Optimize Volume Size:
bash# Monitor usage kubectl top pods --containers df -h # Inside podLifecycle Management:
yaml# Snapshot automation apiVersion: snapshot.storage.k8s.io/v1 kind: VolumeSnapshotClass metadata: name: csi-aws-vsc driver: ebs.csi.aws.com deletionPolicy: DeleteUtilize EFS Storage Classes:
yaml# Infrequent Access storage class parameters: performanceMode: generalPurpose throughputMode: provisioned provisionedThroughputInMibps: "100"Clean Up Unused Volumes:
bash# Check unused PVs kubectl get pv | grep Available # Clean up old snapshots aws ec2 describe-snapshots --owner-ids self \ --query 'Snapshots[?StartTime<=`2023-01-01`]'
Question 5: Security Best Practices
How can you enhance EKS storage security?
Answer:
Enable Encryption:
yamlapiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: encrypted-gp3 provisioner: ebs.csi.aws.com parameters: type: gp3 encrypted: "true" kmsKeyId: "arn:aws:kms:region:account:key/key-id"Minimize IAM Permissions:
json{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:CreateVolume", "ec2:AttachVolume", "ec2:DetachVolume", "ec2:DeleteVolume", "ec2:DescribeVolumes", "ec2:CreateSnapshot", "ec2:DeleteSnapshot", "ec2:DescribeSnapshots" ], "Resource": "*", "Condition": { "StringEquals": { "aws:RequestedRegion": "us-west-2" } } } ] }Network Security:
yaml# EFS mount target security group securityGroupSelector: matchLabels: Name: "efs-mount-target-sg"Access Control:
yaml# RBAC configuration apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: storage-admin rules: - apiGroups: [""] resources: ["persistentvolumes", "persistentvolumeclaims"] verbs: ["get", "list", "create", "delete"]Audit Logging:
yaml# Storage-related audit policy - level: Metadata resources: - group: "" resources: ["persistentvolumes", "persistentvolumeclaims"]
6. What is the most effective tool combination for storage monitoring and management in Amazon EKS?
A. Use only CloudWatch and AWS Console B. CloudWatch, Prometheus, Grafana, and automated management tools C. Manual inspection and log analysis D. Use only third-party monitoring tools
Show Answer
Answer: B. CloudWatch, Prometheus, Grafana, and automated management tools
Explanation: The most effective tool combination for storage monitoring and management in Amazon EKS is using CloudWatch, Prometheus, Grafana, and automated management tools together. This integrated approach collects both AWS-native metrics and detailed Kubernetes-level metrics, visualizes them, and improves operational efficiency through automated management.
Integrated Monitoring and Management Architecture:
CloudWatch:
- Collects AWS infrastructure-level metrics
- EBS, EFS, FSx storage performance metrics
- Alarm and event management
Prometheus:
- Collects detailed Kubernetes-level metrics
- Collects custom storage metrics
- Long-term data retention and querying
Grafana:
- Integrated dashboards and visualization
- Integration of CloudWatch and Prometheus data sources
- Custom alerting and reports
Automated Management Tools:
- Storage provisioning automation
- Capacity planning and scaling
- Problem detection and resolution
Score Calculation:
- 5-6 correct answers: Excellent (EKS storage expert level)
- 3-4 correct answers: Good (additional learning recommended)
- 1-2 correct answers: Fair (basic concept review needed)
- 0 correct answers: Needs improvement (full content re-study required)
Implementation Examples:
CloudWatch Container Insights Setup:
yamlapiVersion: v1 kind: ConfigMap metadata: name: cwagent-config namespace: amazon-cloudwatch data: cwagentconfig.json: | { "logs": { "metrics_collected": { "kubernetes": { "cluster_name": "my-cluster", "metrics_collection_interval": 60 } }, "force_flush_interval": 5 }, "metrics": { "namespace": "EKS/Storage", "metrics_collected": { "statsd": { "service_address": ":8125" } } } }Prometheus and Storage Exporter Setup:
yamlapiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: storage-monitor namespace: monitoring spec: selector: matchLabels: app: storage-exporter endpoints: - port: metrics interval: 30s path: /metricsGrafana Dashboard Configuration:
yamlapiVersion: v1 kind: ConfigMap metadata: name: storage-dashboard namespace: monitoring data: storage-dashboard.json: | { "title": "EKS Storage Dashboard", "panels": [ { "title": "EBS Volume IOPS", "datasource": "Prometheus", "targets": [ { "expr": "aws_ebs_volume_read_ops + aws_ebs_volume_write_ops", "legendFormat": "{{volume_id}}" } ] }, { "title": "EFS Throughput", "datasource": "CloudWatch", "targets": [ { "namespace": "AWS/EFS", "metricName": "TotalIOBytes", "dimensions": { "FileSystemId": "*" }, "statistic": "Sum" } ] } ] }Automated Storage Management CronJob:
yamlapiVersion: batch/v1 kind: CronJob metadata: name: storage-manager spec: schedule: "0 1 * * *" jobTemplate: spec: template: spec: containers: - name: storage-manager image: storage-tools:latest command: - /bin/bash - -c - | # Identify unused PVCs UNUSED_PVCS=$(kubectl get pvc -A -o json | jq -r '.items[] | select(.status.phase == "Bound") | select(.metadata.annotations.lastUsed < "'$(date -d "30 days ago" +%Y-%m-%d)'") | .metadata.name') # Create snapshots for PVC in $UNUSED_PVCS; do kubectl create snapshot ... done # Analyze volume usage and generate reports ... restartPolicy: OnFailure
Key Monitoring Metrics:
EBS Volume Metrics:
- VolumeReadOps/VolumeWriteOps
- VolumeReadBytes/VolumeWriteBytes
- VolumeQueueLength
- BurstBalance (gp2 volumes)
EFS Metrics:
- TotalIOBytes
- DataReadIOBytes/DataWriteIOBytes
- MetadataIOBytes
- ClientConnections
- StorageBytes (Standard/IA)
FSx for Lustre Metrics:
- DataReadBytes/DataWriteBytes
- DataReadOperations/DataWriteOperations
- FreeDataStorageCapacity
- LogicalDiskUsage
Kubernetes Storage Metrics:
- PVC usage and capacity
- Volume mount status
- Storage class usage
Advanced Monitoring and Management Features:
Predictive Analysis:
- Capacity prediction and planning
- Performance trend analysis
- Cost forecasting
Anomaly Detection:
- Detect abnormal I/O patterns
- Early warning of performance degradation
- Capacity shortage prediction
Automated Optimization:
- Volume type recommendations based on usage patterns
- Automatic scaling up and down
- Cost optimization recommendations
Integrated Reporting:
- Storage usage and performance reports
- Cost allocation and analysis
- Compliance and audit reports
Implementation Best Practices:
Multi-Level Monitoring:
- Infrastructure level (CloudWatch)
- Kubernetes level (Prometheus)
- Application level (custom metrics)
Alerting Strategy:
- Set alerts based on severity
- Alert grouping and deduplication
- Define escalation paths
Data Retention Policy:
- High-resolution data: short-term retention
- Aggregated data: long-term retention
- Balance between cost and usefulness
Gradual Automation Introduction:
- Implement monitoring and alerting first
- Add reporting and analysis capabilities
- Gradually introduce automated management
Issues with other options:
- A. Use only CloudWatch and AWS Console: Provides AWS-native metrics but lacks detailed Kubernetes-level metrics and has limited automation capabilities.
- C. Manual inspection and log analysis: Lacks scalability, makes real-time monitoring difficult, and prevents proactive problem detection.
- D. Use only third-party monitoring tools: May have limited integration with AWS-native metrics and can incur additional costs.