K8S对node添加label,并根据label筛选节点

kubectl get node 10.88.10.5 –show-labels

kubectl label nodes kube-node node=kube-node

kubectl get node -a -l “node=kube-node”
pod或者rc的配置项中添加如下配置:

nodeSelector:
node: kube-node4
如mongo启动的rc文件

apiVersion: v1
kind: ReplicationController
metadata:
name: mongo
spec:
replicas: 1
template:
metadata:
labels:
run: mongo
spec:
containers:
– name: mongo
image: daocloud.io/library/mongo:3.2.4
ports:
– containerPort: 27017
volumeMounts:
– mountPath: /data/db
name: mongo
volumes: [{“name”:”mongo”,”hostPath”:{“path”:”/root/volumes/mongo”}}]
nodeSelector:
node: kube-node4


原文链接:https://blog.csdn.net/gsying1474/article/details/59057519

此条目发表在kubernetes分类目录。将固定链接加入收藏夹。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注