给节点打上标签:
在创建pod的yaml文件时: 添加 nodeSelector
# 查看当前集群节点标签信息 kubectl get nodes --show-labels kubectl label nodeGPU=true #打上标签 GPU=true kubectl label nodes node4 deploy.type=assembly_app apiVersion: apps/v1 kind: Pod metadata: name: nginx-pod namespace: my-namespace labels: app: nginx-pod spec: nodeSelector: deploy.type: assembly_app restartPolicy: Always containers: - name: nginx image: "nginx" ports: - containerPort: 80