1.为node节点添加label标签
kubectl label nodes kube-node node=kube-node // add label
kubectl get node -a -l points=test // list label points=test
2.创建rc文件
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 2 // 创建的容器副本数量
template:
metadata:
labels:
run: nginx // service的selector
spec:
containers:
- name: nginx-container
image: nginx:latest
ports:
- containerPort: 80
nodeSelector:
node: kube-node