概述
master是设置了污点的,默认情况下pods是无法运行再master上的,那么如何让pods运行在master上呢?
两种方法:
1、去除master的污点(不建议使用)
2、让pod能容忍这个污点
这里我用的是第二种,先查看master的污点,在将pod设置为能容忍这个污点
1、查看污点
[root@master pos]# kubectl describe node master
Name: master
Roles: master
Labels: 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=
Annotations: flannel.alpha.coreos.com/backend-data: {"VtepMAC":"12:02:e2:16:31:f8"}
flannel.alpha.coreos.com/backend-type: vxlan
flannel.alpha.coreos.com/kube-subnet-manager: true
flannel.alpha.coreos.com/public-ip: 10.0.0.4
kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
node.alpha.kubernetes.io/ttl: 0
volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp: Wed, 08 Apr 2020 05:04:46 +0000
Taints: node-role.kubernetes.io/master:NoSchedule
Unschedulable: false
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
MemoryPressure False Mon, 08 Jun 2020 09:41:56 +0000 Wed, 08 Apr 2020 05:04:45 +0000 KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False Mon, 08 Jun 2020 09:41:56 +0000 Wed, 08 Apr 2020 05:04:45 +0000 KubeletHasNoDiskPressure kubelet has no disk pressure
PIDPressure False Mon, 08 Jun 2020 09:41:56 +0000 Wed, 08 Apr 2020 05:04:45 +0000 KubeletHasSufficientPID kubelet has sufficient PID available
Ready True Mon, 08 Jun 2020 09:41:56 +0000 Wed, 08 Apr 2020 05:06:26 +0000 KubeletReady kubelet is posting ready status
Addresses:
InternalIP: 10.0.0.4
Hostname: master
Capacity:
cpu: 8
。。。省略。。。
2、设置能容忍这个污点
由于使用的是deploy,设置deploy.spec.template.spec.tolerations能容忍master的污点即可
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: hbird
ms-name: pos-registry
name: pos-registry
namespace: hbird
spec:
replicas: 1
selector:
matchLabels:
app: hbird
ms-name: pos-registry
template:
metadata:
labels:
app: hbird
ms-name: pos-registry
spec:
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
containers:
- name: pos-registry
image: jhipster/jhipster-registry:v5.0.2
imagePullPolicy: IfNotPresent
。。。省略。。。
最后
以上就是机智眼神为你收集整理的如何让pods运行在master上的全部内容,希望文章能够帮你解决如何让pods运行在master上所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复