kubectl taint nodes --all node-role.kubernetes.io/master-
部署nginx pod,yaml文件
apiVersion: v1
kind: Pod
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80
kubectl create -f nginx-pod.yaml
使用kubectl describe pod nginx
提示 1 node(s) had taints that the pod didn't tolerate
原因
master node参与工作负载 (只在主节点执行)
使用kubeadm初始化的集群,出于安全考虑Pod不会被调度到Master Node上,也就是说Master Node不参与工作负载。
这里搭建的是测试环境可以使用下面的命令使Master Node参与工作负载:
kubectl taint nodes --all node-role.kubernetes.io/master-