1、给node加标签

kubectl label nodes k8s-slave2 slave=184

2、查看标签

复制代码
[root@k8s_master centos7]# kubectl describe node k8s-slave2
Name:            k8s-slave2
Labels:            beta.kubernetes.io/arch=amd64
            beta.kubernetes.io/os=linux
            kubernetes.io/hostname=k8s-slave2
            slave=184
Taints:            <none>
CreationTimestamp:    Wed, 31 Aug 2016 17:42:09 +0800
复制代码

3、rc文件中指定NodeSelector

复制代码
apiVersion: v1
kind: ReplicationController
metadata:
  name: centos-master
  labels:
    name: centos-master
spec:
  replicas: 1
  selector:
    name: centos-master
  template:
    metadata:
      labels:
        name: centos-master
    spec:
      containers:
      - name: centos
        image: 10.10.30.180/library/centos7:v1
      nodeSelector:
        slave: "184"
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐