CKA 模拟真题 Killer.sh | Question 9 | Kill Scheduler, Manual Scheduling
Use context: kubectl config use-context k8s-c2-AC
Ssh into the controlplane node with ssh cluster2-controlplane1 . Temporarily stop the kube-scheduler, this means in a way that you can start it again afterwards.
Create a single Pod named manual-schedule of image httpd:2.4-alpine , confirm it’s created but not scheduled on any node.
Now you’re the scheduler and have all its power, manually schedule that Pod on node cluster2-controlplane1. Make sure it’s running.
Start the kube-scheduler again and confirm it’s running correctly by creating a second Pod named manual-schedule2 of image httpd:2.4-alpine and check if it’s running on cluster2-node1.
译文
用 ssh cluster2-controlplane1 登录控制板节点。暂时停止 kube-scheduler ,这意味着你可以在之后再次启动它。
创建一个名为 manual-schedule 的 Pod,镜像为 httpd:2.4-alpine ,确认它已经创建,但没有在任何节点上调度。
现在你是调度员,拥有它的所有权力,在 cluster2-controlplane1 节点上手动调度这个 Pod 。确保它正在运行。
再次启动 kube-scheduler ,通过创建第二个Pod manual-schedule2 使用镜像 httpd:2.4-alpine ,并检查它是否在 cluster2-node1 上运行,确认它运行正常。
解答
kubectl config use-context k8s-c2-AC |
检查并找出 controlplane 节点,
k get node |
连接上远程节点并检查调度程序是否正在运行。
ssh cluster2-controlplane1 |
通过移出yaml文件结束调度pod
root@cluster2-controlplane1:~# mv /etc/kubernetes/manifests/kube-scheduler.yaml . |
创建pod,并检查状态
k run manual-schedule --image=httpd:2.4-alpine |
编辑pod
k get pod manual-schedule -o yaml > 9.yaml |
9.yaml
# 9.yaml |
由于我们不能用kubectl应用或kubectl编辑,在这种情况下,我们需要删除并创建或替换
k -f 9.yaml replace --force |
再次调度
ssh cluster2-controlplane1 |
k run manual-schedule2 --image=httpd:2.4-alpine |



