将Pod调度到VNode
更新时间:2025-06-05
本文介绍如何将Pod调度到VNode。 对于自建的Kubernetes集群,即混合使用普通节点和虚拟节点(VNode)的模式下,您可以通过配置nodeSelector和tolerations,将Pod调度到VNode上,以BCI来运行。
概述
VNode对标原生kubernetes节点,在混合使用普通节点和VNode的模式下,支持通过配置nodeSelector和tolerations的方式,将Pod调度到VNode。
配置示例
在Pod Spec中添加如下的nodeSelector和tolerations字段,将Pod调度到虚拟节点上。
                Plain Text
                
            
            1apiVersion: apps/v1
2kind: Deployment
3metadata:
4  labels:
5    type: pod-perf-test
6  name: nginx-test
7  namespace: default
8spec:
9  replicas: 1
10  revisionHistoryLimit: 10
11  selector:
12    matchLabels:
13      type: pod-perf-test
14  template:
15    metadata:
16      labels:
17        type: pod-perf-test
18    spec:
19      containers:
20      - image: registry.baidubce.com/qatest/nginx:1.23.0
21        imagePullPolicy: IfNotPresent
22        name: pod-perf-test
23        resources:
24          limits:
25            cpu: 0.25
26            memory: 512Mi
27          requests:
28            cpu: 0.25
29            memory: 512Mi
30        terminationMessagePath: /dev/termination-log
31        terminationMessagePolicy: File
32      dnsPolicy: Default
33      nodeSelector:
34        type: virtual-kubelet
35      tolerations:
36      - effect: NoSchedule
37        key: virtual-kubelet.io/provider
38        operator: Equal
39        value: baidu
            调度到虚拟节点上的Pod会以BCI Pod的形式启动。
