aegislm / deployment /k8s /gpu-node-pool.yaml
ACA050's picture
Upload 57 files
f2c6053 verified
Raw
History Blame Contribute Delete
5.72 kB
---
# AegisLM GPU Node Pool Configuration
# Kubernetes node pool configuration for GPU workloads
# Multi-Agent Adversarial LLM Evaluation Framework
# GPU Node Pool Configuration
# This defines the node selector and taints for GPU workloads
# Apply with: kubectl apply -f gpu-node-pool.yaml
---
# Node Pool Configuration for GPU workloads
apiVersion: v1
kind: ConfigMap
metadata:
name: aegislm-gpu-config
namespace: aegislm
labels:
app: aegislm
component: gpu-pool
data:
# Node selector labels
node-selector.json: |
{
"workload": "benchmark",
"accelerator": "nvidia"
}
# GPU tolerations
gpu-tolerations.json: |
[
{
"key": "nvidia.com/gpu",
"operator": "Exists",
"effect": "NoSchedule"
}
]
# Resource limits per pod
resource-limits.json: |
{
"nvidia.com/gpu": 1,
"cpu": "4",
"memory": "16Gi"
}
---
# Cluster Autoscaler Configuration
# Add this to your cluster autoscaler deployment
apiVersion: v1
kind: ConfigMap
metadata:
name: cluster-autoscaler-status
namespace: kube-system
labels:
app: cluster-autoscaler
data:
# GPU node pool scaling configuration
# Note: This is informational - actual autoscaler config depends on your cloud provider
gpu-scaling-rules.yaml: |
# GPU Node Pool Auto-Scaling Rules
#
# Scale UP condition:
# pending_gpu_jobs > available_gpus
#
# Scale DOWN condition:
# gpu_utilization < threshold for N minutes
#
# Example configuration for GKE:
# gcloud container clusters update CLUSTER_NAME \
# --enable-autoscaling \
# --min-nodes=0 \
# --max-nodes=10 \
# --node-pool=gpu-pool
# Scaling formula:
# T_scale_up = max(1, pending_jobs - available_gpus)
# T_scale_down = max(0, idle_minutes - cool_down_period)
# Parameters:
# - min_nodes: 0 (scale to zero when idle)
# - max_nodes: 10 (max GPU nodes)
# - scale_up_delay: 1 minute
# - scale_down_delay: 10 minutes (cool down period)
# - gpu_utilization_threshold: 30% (scale down if below)
# Spot/Preemptive instance configuration (future):
# - Use spot instances for cost optimization
# - Handle spot interruptions gracefully
---
# GPU Node Labels (for manual node labeling)
apiVersion: v1
kind: ConfigMap
metadata:
name: node-labels
namespace: aegislm
labels:
app: aegislm
data:
# Label GPU nodes with these commands:
# kubectl label nodes <node-name> workload=benchmark
# kubectl label nodes <node-name> accelerator=nvidia
# kubectl label nodes <node-name> gpu-type=<type> # e.g., v100, a100, a10
label-commands.sh: |
#!/bin/bash
# Label GPU nodes for AegisLM workloads
# For each GPU node:
# kubectl label nodes $NODE_NAME \
# workload=benchmark \
# accelerator=nvidia \
# gpu-type=a10 \
# gpu-count=1
---
# GPU Resource Quota (optional - for multi-tenant)
apiVersion: v1
kind: ResourceQuota
metadata:
name: gpu-quota
namespace: aegislm
labels:
app: aegislm
spec:
hard:
# Limit total GPUs across all pods
nvidia.com/gpu: "10"
# Limit CPU and memory
requests.cpu: "40"
requests.memory: "64Gi"
limits.cpu: "80"
limits.memory: "128Gi"
scopeSelector:
matchExpressions:
- operator: In
scopeName: PriorityClass
values: ["high-priority", "normal-priority"]
---
# LimitRange for GPU Pods
apiVersion: v1
kind: LimitRange
metadata:
name: gpu-limits
namespace: aegislm
labels:
app: aegislm
spec:
limits:
# Default limits for GPU pods
- type: Container
default:
nvidia.com/gpu: "1"
cpu: "4"
memory: "16Gi"
defaultRequest:
nvidia.com/gpu: "1"
cpu: "2"
memory: "8Gi"
max:
nvidia.com/gpu: "2"
cpu: "8"
memory: "32Gi"
min:
nvidia.com/gpu: "0"
cpu: "100m"
memory: "128Mi"
# Pod-level limits
- type: Pod
max:
nvidia.com/gpu: "2"
cpu: "16"
memory: "64Gi"
---
# PriorityClass for GPU workloads
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: high-priority
labels:
app: aegislm
value: 1000000
globalDefault: false
description: "High priority for GPU-accelerated benchmark jobs"
---
# PriorityClass for normal workloads
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: normal-priority
labels:
app: aegislm
value: 0
globalDefault: true
description: "Normal priority for standard workloads"
---
# Horizontal Pod Autoscaler for GPU node pool (if using metrics-server)
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: aegislm-gpu-hpa
namespace: aegislm
labels:
app: aegislm
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: aegislm-worker
minReplicas: 0
maxReplicas: 10
metrics:
- type: Resource
resource:
name: nvidia.com/gpu
target:
type: Utilization
averageUtilization: 70
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 50
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Percent
value: 100
periodSeconds: 15
- type: Pods
value: 2
periodSeconds: 15
selectPolicy: Max