CKA备战12-真题:将 pod 部署到指定 node 节点上
题目TaskSchedule a pod as follows:Name:nginx-kusc00401Image:nginxNode selector:disk=spinning答案官网:Kubernetes 文档/概念/工作负载/Pods,Kubernetes 文档/概念/调度,抢占和驱逐/将 Pod 分配给节点https://kubernetes.io/zh/docs/concepts/wo
·
题目
Task
Schedule a pod as follows:
- Name:nginx-kusc00401
- Image:nginx
- Node selector:disk=spinning
答案
官网:Kubernetes 文档/概念/工作负载/Pods,Kubernetes 文档/概念/调度,抢占和驱逐/将 Pod 分配给节点
https://kubernetes.io/zh/docs/concepts/workloads/pods/pod-topology-spread-constraints/
[root@test CKA]# cat nginx.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-kusc00401
labels:
env: test
spec:
containers:
- name: nginx
image: nginx
imagePullPolicy: IfNotPresent
nodeSelector:
disk: spinning
启动
kubectl apply -f nginx.yaml
或者使用 kubectl run
kubectl run nginx-kusc00401 --image=nginx --dry-run='client' -o yaml > test-nginx.yaml
在生成的yaml这添加 nodeSelector
更多推荐
已为社区贡献1条内容
所有评论(0)