可以通过kubectl edit deployment tiller-deploy -n kube-system指定node标签即可。
例如:首先查看node标签 kubectl get node --show-labels
[root@LFA-L0170086 kubernetes]# kubectl get node --show-labels
NAME STATUS ROLES AGE VERSION LABELS
master Ready master 19h v1.15.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=master,kubernetes.io/os=linux,node-role.kubernetes.io/master=
node1 Ready <none> 5h1m v1.15.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=node1,kubernetes.io/os=linux
node2 Ready <none> 4h22m v1.15.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=node2,kubernetes.io/os=linux
要将pod部署在master上,需要找出master私有标签:kubernetes.io/hostname=master
然后编辑deployment 或者yaml文件,添加nodeSelector属性:
.......
59 name: tiller
60 ports:
61 - containerPort: 44134
62 name: tiller
63 protocol: TCP
64 - containerPort: 44135
65 name: http
66 protocol: TCP
67 readinessProbe:
68 failureThreshold: 3
69 httpGet:
70 path: /readiness
71 port: 44135
72 scheme: HTTP
73 initialDelaySeconds: 1
74 periodSeconds: 10
75 successThreshold: 1
76 timeoutSeconds: 1
77 resources: {}
78 terminationMessagePath: /dev/termination-log
79 terminationMessagePolicy: File
80 dnsPolicy: ClusterFirst
81 nodeSelector:
82 kubernetes.io/hostname: master
.......
若是kubectl edit直接保持即可重新部署,若是yaml需要重新apply
网友评论