Helm快速安装
使用Helm Chart 1.8.3快速安装TensorFusion控制面
快速安装
默认安装不启用Cluster Agent,也不依赖TensorFusion控制台。Chart会自动创建NVIDIA ProviderConfig、SchedulingConfigTemplate和默认TensorFusionCluster,无需再手工应用集群配置清单。
第一步,使用Helm命令一键安装TensorFusion。
默认通过nvidia.com/gpu.present=true发现NVIDIA GPU节点,该标签通常由GPU Feature Discovery、云厂商组件或集群初始化脚本设置。无GPU的集群不需要添加该标签。
helm repo add tensor-fusion https://nexusgpu.github.io/tensor-fusion --force-update
helm repo update tensor-fusionhelm upgrade --install tensor-fusion-sys tensor-fusion/tensor-fusion \
--version 1.8.3 --namespace tensor-fusion-sys --create-namespace \
--wait --timeout 10m \
-f https://download.tensor-fusion.ai/values-cn.yamlhelm upgrade --install tensor-fusion-sys tensor-fusion/tensor-fusion \
--version 1.8.3 --namespace tensor-fusion-sys --create-namespace \
--wait --timeout 10mhelm upgrade --install tensor-fusion-sys tensor-fusion/tensor-fusion \
--version 1.8.3 --namespace tensor-fusion-sys --create-namespace \
--wait --timeout 10m \
--set agent.enrollToken=xxx --set agent.agentId=xxx \
--set agent.cloudEndpoint=wss://your-own.domain/_ws第二步,验证TensorFusion控制面是否安装成功。
kubectl get deployment,pods -n tensor-fusion-sys
kubectl get providerconfig,tensorfusioncluster,gpupool
kubectl get pods -n tensor-fusion-sys -l tensor-fusion.ai/component=hypervisor
# controller和alert-manager应为Ready/Running
# 默认资源包括nvidia-provider、tensor-fusion和tensor-fusion-shared
# 无GPU节点时,最后一条命令应返回No resources found无GPU的集群只验证控制面即可。没有节点命中nvidia.com/gpu.present=true时,不会创建GPUNode或Hypervisor Pod,默认TFC/GPUPool可能保持Updating,这是预期行为。
有GPU的集群还应看到hypervisor-<节点名称>进入Running,并确认tensor-fusion-shared为Running。随后可部署一个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/gpu-count: '1'
tensor-fusion.ai/gpupool: tensor-fusion-shared
tensor-fusion.ai/is-local-gpu: 'false'
tensor-fusion.ai/isolation: soft
tensor-fusion.ai/tflops-limit: '20'
tensor-fusion.ai/tflops-request: '10'
tensor-fusion.ai/vendor: NVIDIA
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资源分配:
kubectl exec deploy/pytorch-example -- 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 -常见问题
如果集群有GPU,但hypervisor Pod未显示,请检查GPU节点是否带有nvidia.com/gpu.present=true标签。无GPU节点时不应创建hypervisor。
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节点缺少默认标签时,可以补充标签:
kubectl label node <gpu-node-name> nvidia.com/gpu.present=true如果集群使用值为true的自定义GPU标签,需要同时修改operator初始扫描selector和默认GPU资源池的节点选择器:
helm upgrade --install tensor-fusion-sys tensor-fusion/tensor-fusion \
--version 1.8.3 --namespace tensor-fusion-sys --create-namespace \
--set initialGpuNodeLabelSelector="your-own-gpu-label-key=true" \
--set cluster.pool.nodeSelectorKey="your-own-gpu-label-key"节点隔离模式由GPUPool的nodeManagerConfig.defaultIsolationMode和有序的isolationModeRules统一控制,无需给Node添加tensor-fusion.ai/isolationMode标签。