EKS cluster wide GPU Cost Attribution
இந்த post Amazon EKS-ல் GPU slice cost allocation-க்கான end-to-end proof of concept (PoC)-ஐ விவரிக்கிறது.
சிக்கல் அறிக்கை
பல tenants GPU capacity-ஐ (எ.கா., MIG slices) பகிர்ந்து கொள்ளும்போது, நீங்கள் பதிலளிக்க வேண்டியவை:
- யார் எந்த share-ஐ கோரினார்கள் GPU-வின் (pod / namespace / BU மூலம்)?
- யார் உண்மையில் GPU-ஐ பயன்படுத்தினார்கள் (எவ்வளவு)?
- $12 per GPU-hour போன்ற "public" price கொடுக்கப்பட்டால், எவ்வாறு கணக்கிடுவது:
- Allocated cost (requested share அடிப்படையில்)
- Effective cost (observed utilization அடிப்படையில்)
- Waste (allocated minus effective)
Architecture (உயர் நிலை)

முன்நிபந்தனைகள்
AWS + EKS முன்நிபந்தனைகள்
- பின்வருவனவற்றை உருவாக்க அனுமதி கொண்ட AWS account:
- EKS clusters + nodegroups
- IAM roles for service accounts (IRSA)
- AMP workspace
- உங்கள் region-ல் GPU instances இயக்க Quota மற்றும் AZ capacity
பயன்படுத்தப்படும் Variables
export AWS_REGION="us-west-2"
export CLUSTER_NAME="gpu-cost-poc"
export AMP_ALIAS="gpu-cost-poc"
# Public/benchmark price you want to demonstrate (not CUR yet)
export GPU_HOURLY_RATE="12"
# MIG profile for the PoC (eg: A100 40GB commonly supports 1g.5gb with 7 slices/GPU)
export MIG_PROFILE_LABEL="all-1g.5gb"
# IMPORTANT: in this PoC, MIG slices were exposed as nvidia.com/gpu (1 "gpu" == 1 MIG slice)
export MIG_RESOURCE_KEY="nvidia.com/gpu"
# For 1g.5gb on A100: typically 7 slices per physical GPU
export SLICES_PER_GPU="7"
# kube-state-metrics may "sanitize" extended resource names
export KSM_RESOURCE_REGEX='nvidia.*(gpu|mig).*'
படிப்படியான வழிமுறைகள்
படி 1 — EKS cluster உருவாக்குதல்
உங்கள் eksctl ஆதரிக்கும் versions-ஐ பட்டியலிடுங்கள்:
eksctl utils describe cluster-versions
Cluster-ஐ உருவாக்குங்கள் (ஆதரிக்கப்படும் default-ஐ eksctl தேர்வு செய்ய --version-ஐ தவிர்க்கவும்):
eksctl create cluster \
--name "$CLUSTER_NAME" \
--region "$AWS_REGION" \
--managed
படி 2 — "system" nodegroup சேர்த்தல் (பரிந்துரைக்கப்படுகிறது)
CoreDNS மற்றும் operators-ஐ விலையுயர்ந்த GPU nodes-லிருந்து தள்ளி வைக்கிறது.
eksctl create nodegroup \
--cluster "$CLUSTER_NAME" \
--region "$AWS_REGION" \
--name "system-ng" \
--node-type "m5.large" \
--nodes 2 --nodes-min 2 --nodes-max 3
படி 3 — GPU nodegroup சேர்த்தல்
eksctl create nodegroup \
--cluster "$CLUSTER_NAME" \
--region "$AWS_REGION" \
--name "gpu-ng-ubuntu" \
--node-type "p4d.24xlarge" \
--node-ami-family "Ubuntu2204" \
--install-nvidia-plugin=false \
--nodes 1 --nodes-min 1 --nodes-max 1 \
--node-labels "workload=gpu"
GPU workloads மட்டுமே schedule ஆகும்படி taint apply செய்யுங்கள்:
kubectl taint nodes -l workload=gpu nvidia.com/gpu=present:NoSchedule --overwrite
படி 4 — NVIDIA GPU Operator நிறுவுதல் (MIG enabled)
helm repo add nvidia https://helm.ngc.nvidia.com/nvidia
helm repo update
helm upgrade --install gpu-operator nvidia/gpu-operator \
-n gpu-operator --create-namespace \
--set mig.strategy=single
படி 5 — GPU node(s)-ல் MIG profile enable செய்தல்
தற்போதைய MIG labels-ஐ சரிபாருங்கள்:
kubectl get nodes -l workload=gpu -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.labels.nvidia\.com/mig\.capable}{"\t"}{.metadata.labels.nvidia\.com/mig\.config}{"\t"}{.metadata.labels.nvidia\.com/mig\.config\.state}{"\n"}{end}'
MIG geometry apply செய்யுங்கள்:
kubectl label nodes -l workload=gpu nvidia.com/mig.config="$MIG_PROFILE_LABEL" --overwrite
வெற்றிக்காக காத்திருங்கள்:
kubectl get nodes -l workload=gpu -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.labels.nvidia\.com/mig\.config}{"\t"}{.metadata.labels.nvidia\.com/mig\.config\.state}{"\n"}{end}'
படி 6 — AMP workspace உருவாக்குதல்
aws amp create-workspace --alias "$AMP_ALIAS" --region "$AWS_REGION"
export AMP_WORKSPACE_ID="$(aws amp list-workspaces --region "$AWS_REGION" --query "workspaces[?alias=='$AMP_ALIAS'].workspaceId | [0]" --output text)"
export AMP_ENDPOINT="$(aws amp describe-workspace --workspace-id "$AMP_WORKSPACE_ID" --region "$AWS_REGION" --query "workspace.prometheusEndpoint" --output text)"
echo "$AMP_WORKSPACE_ID"
echo "$AMP_ENDPOINT"
படி 7 — ingest + query-க்கான IRSA
eksctl utils associate-iam-oidc-provider \
--cluster "$CLUSTER_NAME" \
--region "$AWS_REGION" \
--approve
eksctl create iamserviceaccount \
--cluster "$CLUSTER_NAME" --region "$AWS_REGION" \
--name amp-ingest --namespace observability \
--attach-policy-arn arn:aws:iam::aws:policy/AmazonPrometheusRemoteWriteAccess \
--approve --override-existing-serviceaccounts
eksctl create iamserviceaccount \
--cluster "$CLUSTER_NAME" --region "$AWS_REGION" \
--name amp-query --namespace observability \
--attach-policy-arn arn:aws:iam::aws:policy/AmazonPrometheusQueryAccess \
--approve --override-existing-serviceaccounts
படி 8 — kube-state-metrics நிறுவுதல்
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm upgrade --install kube-state-metrics prometheus-community/kube-state-metrics \
-n kube-system
படி 9 — OTel collector Deploy செய்தல் (Prometheus scrape → AMP remote_write)
kubectl -n observability patch configmap amp-scraper-otel-env --type merge -p "$(cat <<PATCH
{
"data": {
"AWS_REGION": "${AWS_REGION}",
"AMP_ENDPOINT": "${AMP_ENDPOINT}"
}
}
PATCH
)"
kubectl -n observability rollout restart deploy/amp-scraper-otel
kubectl -n observability rollout status deploy/amp-scraper-otel