Kubernetes 入门
#登录与自检
ssh ubuntu@<跳板机IP>
kubectl get nodes
kubectl get nodes -o custom-columns='NODE:.metadata.name,GPU:.status.allocatable.nvidia\.com/gpu'
服务节点 + 全部 worker 应为 Ready;每个 worker 的 GPU 列应为 8。
kubeconfig 常见路径:
/root/.kube/config
/home/ubuntu/.kube/config
k9s、helm 开箱可用。欢迎语若仍提示 NOT READY,见 校验。
#第一个作业:双节点 NCCL
跳板机 /home/ubuntu/ 下通常有按本集群硬件渲染好的 *all_reduce* YAML(已带正确的 NCCL_IB_PKEY 等)。示例:
kubectl create -f /home/ubuntu/你的_all_reduce_perf_2_nodes.yml
kubectl get pods
kubectl logs -f <launcher-pod名> | tail -20
关注:
- - Avg bus bandwidth:大消息健康值常见数百 GB/s 量级
- -
#wrong列:应为0;非 0 表示数据损坏,应提工单
首次拉镜像可能较慢。全集群变体若预置,可一并试跑。
#日常监控命令
kubectl get pods
kubectl logs -f <pod>
kubectl describe pod <pod>
kubectl get mpijobs
kubectl top nodes
kubectl top pods
#容器镜像
Worker 用 containerd 拉镜像。私有仓库:
kubectl create secret docker-registry my-registry \
--docker-server=<仓库域名> \
--docker-username=<用户> \
--docker-password=<令牌>
在 Pod / MPIJob 的 imagePullSecrets 里引用。公开 NGC / Docker Hub 可先试用。
#下一步
- - 多节点工作负载 — 自己写 MPIJob
- - 作业排队(Kueue) — 排队与配额
- - 存储 — 选对 StorageClass