Helm本地安装
使用Helm在本地安装TensorFusion,无需Cluster Agent和Cloud Console
无ClusterAgent模式本地安装
当您需要纯本地安装且不需要使用高级功能时,可以使用此选项,但无法使用TensorFusion控制台进行集中管理。
第一步,使用Helm命令一键安装TensorFusion。
Helm Chart 默认按 nvidia.com/gpu.present=true 识别 NVIDIA GPU 节点,但不会自动给 Node 打标签。请确认 GPU 节点已由 GPU Feature Discovery、云厂商组件或集群初始化脚本打上该标签;没有该标签时需要手动补充。只有节点使用自定义 GPU 标签时,才需要覆盖 initialGpuNodeLabelSelector。
soft、hard、shared、MIG 是 TensorFusion 工作负载的隔离方式。Helm 当前不会自动给 Node 打 tensor-fusion.ai/isolationMode 这类隔离模式标签;如需把某些 GPU 节点固定为特定 Hypervisor 隔离模式,需要手动给对应节点打标签。MIG 在配置值中对应 partitioned,不是 mig。
helm upgrade --install --create-namespace --namespace tensor-fusion-sys \
--repo https://download.tensor-fusion.ai \
--set agent.agentId="" -f https://download.tensor-fusion.ai/values-cn.yaml \
tensor-fusion-sys tensor-fusionhelm upgrade --install --create-namespace --namespace tensor-fusion-sys \
--repo https://download.tensor-fusion.ai \
--set agent.agentId="" tensor-fusion-sys tensor-fusionhelm upgrade --install --create-namespace --namespace tensor-fusion-sys \
--repo https://download.tensor-fusion.ai \
--set agent.enrollToken=xxx --set agent.agentId=xxx \
--set agent.cloudEndpoint=wss://your-own.domain/_ws \
tensor-fusion-sys tensor-fusion第二步,验证TensorFusion是否安装成功。
默认 Helm 配置会自动创建面向 NVIDIA GPU 集群的 TensorFusionCluster 和 SchedulingConfigTemplate,正常情况下不需要手动应用集群配置清单。
kubectl get pods -n tensor-fusion-sys
# NAME READY STATUS RESTARTS AGE
# hypervisor-<节点名称> 1/1 Running 0 2m
kubectl get tensorfusionclusters
# 预期输出:
# NAME STATUS AGE
# tensor-fusion Ready 2m
kubectl get gpupool
# 预期输出包含默认 NVIDIA GPU 资源池:
# NAME STATUS AGE
# tensor-fusion-shared Ready 2m
kubectl get schedulingconfigtemplates
# 预期输出:
# NAME AGE
# tf-scheduling-config 2m如果没有看到 TensorFusionCluster 或 SchedulingConfigTemplate,可补充应用默认清单:
kubectl apply -f https://app.tensor-fusion.ai/tmpl/tf-cluster-cn
kubectl apply -f https://app.tensor-fusion.ai/tmpl/tf-scheduling-configkubectl apply -f https://app.tensor-fusion.ai/tmpl/tf-cluster
kubectl apply -f https://app.tensor-fusion.ai/tmpl/tf-scheduling-config最后,部署一个Pytorch Pod来端到端验证TensorFusion远程vGPU:
# simple-pytorch.yaml
# kubectl apply -f simple-pytorch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: pytorch-example
namespace: default
labels:
app: pytorch-example
tensor-fusion.ai/enabled: 'true'
spec:
replicas: 1
selector:
matchLabels:
app: pytorch-example
template:
metadata:
labels:
app: pytorch-example
tensor-fusion.ai/enabled: 'true'
annotations:
tensor-fusion.ai/inject-container: python
tensor-fusion.ai/tflops-limit: '10'
tensor-fusion.ai/tflops-request: '20'
tensor-fusion.ai/vram-limit: 4Gi
tensor-fusion.ai/vram-request: 4Gi
spec:
containers:
- name: python
image: docker.m.daocloud.io/pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime
command:
- sh
- '-c'
- sleep 1d
restartPolicy: Always
terminationGracePeriodSeconds: 0
dnsPolicy: ClusterFirst执行以下命令验证GPU资源分配:
nvidia-smi
# 预期显存为4Gi,而不是显卡的总显存数量执行以下脚本,可在虚拟GPU中运行Qwen3 0.6B,验证推理结果
pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple
pip install modelscope packaging transformers accelerate
cat << EOF >> test-qwen.py
from modelscope import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen3-0.6B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="cuda:0"
)
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
try:
# rindex finding 151668 (</think>)
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
print("thinking content:", thinking_content)
print("content:", content)
EOF
python3 test-qwen.py卸载TensorFusion
运行如下命令一键卸载所有组件
# 可指定 KUBECONFIG 环境变量
curl -sfL https://download.tensor-fusion.ai/uninstall.sh | sh -常见问题
如果 hypervisor Pod 未显示,请先检查 NVIDIA GPU 节点是否带有默认标签 nvidia.com/gpu.present=true:
kubectl get nodes --show-labels | grep nvidia.com/gpu.present=true
# 预期找到GPU节点输出:
# gpu-node-name Ready <none> 42h v1.32.1 beta.kubernetes.io/arch=amd64,...,kubernetes.io/os=linux,nvidia.com/gpu.present=true如果节点缺少该标签,可在创建集群时通过 IaC/userdata 添加,或手动补充:
kubectl label node <gpu-node-name> nvidia.com/gpu.present=true如果需要按节点固定 Hypervisor 隔离模式,可手动设置 tensor-fusion.ai/isolationMode。不设置时默认按 soft 模式处理;只有需要固定 hard、shared 或 MIG(partitioned)节点时才建议显式打标。
kubectl label node <gpu-node-name> tensor-fusion.ai/isolationMode=hard
# MIG 节点使用 partitioned:
kubectl label node <mig-gpu-node-name> tensor-fusion.ai/isolationMode=partitioned
# 可选值:soft、hard、shared、partitioned业务 Pod 如果没有设置 tensor-fusion.ai/isolation,默认使用 soft 隔离模式。需要显式指定时,可在 Pod annotations 中添加:
metadata:
annotations:
tensor-fusion.ai/isolation: softMIG 场景使用 partitioned。前提是 GPU 型号支持 MIG,且目标节点已开启 MIG;仅设置 annotation 或 Node label 不会自动开启 MIG。
metadata:
annotations:
tensor-fusion.ai/isolation: partitioned如果您的 NVIDIA 集群使用自定义 GPU 标签,且标签值仍为 true,请同时覆盖 controller 的初始扫描 selector 和默认 GPU 资源池的节点选择器:
helm upgrade --install --create-namespace --namespace tensor-fusion-sys \
--repo https://download.tensor-fusion.ai \
--set agent.agentId="" \
--set initialGpuNodeLabelSelector="your-own-gpu-label-key=true" \
--set cluster.pool.nodeSelectorKey="your-own-gpu-label-key" \
tensor-fusion-sys tensor-fusion如果标签值不是 true,请关闭默认 NVIDIA cluster,并使用自己的 TensorFusionCluster 资源指定完整 selector:
helm upgrade --install --create-namespace --namespace tensor-fusion-sys \
--repo https://download.tensor-fusion.ai \
--set agent.agentId="" \
--set cluster.enabled=false \
--set initialGpuNodeLabelSelector="your-own-gpu-label-key=value" \
tensor-fusion-sys tensor-fusion
# 在自定义 TensorFusionCluster 中配置:
# nodeManagerConfig:
# nodeSelector:
# nodeSelectorTerms:
# - matchExpressions:
# - key: your-own-gpu-label-key
# operator: In
# values:
# - "value"