Upgrade
Overviewâ
Upgrading HAMi to a new version should be done carefully to avoid disrupting GPU workloads. This guide covers the upgrade process, compatibility considerations, and best practices.
Before You Upgradeâ
1. Check Compatibilityâ
Verify that your target HAMi version is compatible with your current Kubernetes version and NVIDIA driver:
# Current HAMi version
helm list -n kube-system | grep hami
# Kubernetes version
kubectl version
# NVIDIA driver version (on GPU nodes)
nvidia-smi | grep "Driver Version"
2. Backup Current Configurationâ
Save your current HAMi configuration in case you need to rollback:
# Backup current values
helm get values hami -n kube-system > hami-backup-values.yaml
# Backup ConfigMaps
kubectl get configmap hami-scheduler-device -n kube-system -o yaml > hami-configmap-backup.yaml
# Check current state
kubectl get all -n kube-system -l app.kubernetes.io/instance=hami -o yaml > hami-state-backup.yaml
3. Clear Running Workloadsâ
CRITICAL: Before upgrading, stop or reschedule all GPU workloads. Upgrading with running tasks can cause segmentation faults and unpredictable behavior.
Gracefully drain GPU workloads:
# Find pods using GPU
kubectl get pods --all-namespaces -o json | jq -r '.items[] | select(.spec.containers[]?.resources.limits | select(. != null) | select(has("nvidia.com/gpu"))) | "\(.metadata.namespace) \(.metadata.name)"'
# Delete or reschedule these pods
kubectl delete pods <pod-name> -n <namespace> --grace-period=30
Or reschedule to non-GPU nodes if available:
# Add node selector to force scheduling away from GPU nodes
kubectl patch deployment <deployment-name> -n <namespace> -p '{"spec":{"template":{"spec":{"nodeSelector":{"gpu":"false"}}}}}'
4. Verify HAMi Components Are Runningâ
Before proceeding, ensure all HAMi components are healthy:
# Check pod status
kubectl get pods -n kube-system -l app.kubernetes.io/instance=hami
# Check for errors
kubectl logs -n kube-system -l app.kubernetes.io/component=hami-scheduler --tail=50
kubectl logs -n kube-system -l app.kubernetes.io/component=hami-device-plugin --tail=50
Upgrade Processâ
Standard Upgrade (Recommended)â
For most cases, use the standard upgrade process:
# Update Helm repository
helm repo update hami-charts
# Check available versions
helm search repo hami-charts/hami --versions
# Get current values (preserve custom configuration)
helm get values hami -n kube-system > current-values.yaml
# Perform upgrade
helm upgrade hami hami-charts/hami -n kube-system -f current-values.yaml
In-Place Upgrade (If Using Existing Installation)â
If you do not have a custom values file, you can upgrade directly:
helm repo update hami-charts
helm upgrade hami hami-charts/hami -n kube-system
Uninstall and Reinstall (For Major Version Changes)â
For major version upgrades with breaking changes, uninstall first:
# Uninstall current version
helm uninstall hami -n kube-system
# Update repository
helm repo update
# Reinstall with new version
helm install hami hami-charts/hami -n kube-system
Post-Upgrade Verificationâ
After the upgrade completes, verify that HAMi is functioning correctly:
1. Check Pod Statusâ
kubectl get pods -n kube-system -l app.kubernetes.io/instance=hami
All pods should be in Running state.
2. Verify Component Healthâ
# Check scheduler logs for errors
kubectl logs -n kube-system -l app.kubernetes.io/component=hami-scheduler | grep -i "error\|warning" | head -20
# Check device plugin logs
kubectl logs -n kube-system -l app.kubernetes.io/component=hami-device-plugin | grep -i "error" | head -20
3. Test GPU Allocationâ
Deploy a test pod to verify GPU resources are properly allocated:
kubectl apply -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
name: gpu-test-pod
namespace: default
spec:
containers:
- name: test
image: nvidia/cuda:12.2.0-runtime-ubuntu22.04
command: ["nvidia-smi"]
resources:
limits:
nvidia.com/gpu: 1
restartPolicy: Never
EOF
# Check if pod runs successfully
kubectl logs gpu-test-pod
# Clean up
kubectl delete pod gpu-test-pod
4. Verify Node GPU Statusâ
# Check GPU allocatable resources on each node
kubectl describe nodes | grep -A 5 "Allocated resources"
# Check HAMi annotations on nodes
kubectl get nodes -o yaml | grep -A 10 "hami.io"