k8s 练习(二)

1、We have deployed a number of PODs. They are labelled with tier, env and bu. How many PODs exist in the dev environment (env)?
在这里插入图片描述
2、We have deployed a number of PODs. They are labelled with tier, env and bu. How many PODs exist in the dev environment (env)?
在这里插入图片描述
3、How many objects are in the prod environment including PODs, ReplicaSets and any other objects?
在这里插入图片描述
4、Identify the POD which is part of the prod environment, the finance BU and of frontend tier?
在这里插入图片描述
5、Create a taint on node01 with key of spray, value of mortein and effect of NoSchedule
在这里插入图片描述
6、Create a new pod with the nginx image and pod name as mosquito.
在这里插入图片描述
7、Create another pod named bee with the nginx image, which has a toleration set to the taint mortein.
在这里插入图片描述
8、Remove the taint on controlplane, which currently has the taint effect of NoSchedule.
在这里插入图片描述
在这里插入图片描述
9、Apply a label color=blue to node node01
在这里插入图片描述
10、Create a new deployment named blue with the nginx image and 3 replicas.
在这里插入图片描述
11、Set Node Affinity to the deployment to place the pods on node01 only.

Name: blue

Replicas: 3

Image: nginx

NodeAffinity: requiredDuringSchedulingIgnoredDuringExecution

Key: color

value: blue
在这里插入图片描述
在这里插入图片描述
12、Create a new deployment named red with the nginx image and 2 replicas, and ensure it gets placed on the controlplane node only.

Use the label key - node-role.kubernetes.io/master - which is already set on the controlplane node.
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

13、resource-limit and request(资源的要求和限制)

https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
在这里插入图片描述

14、将pod删除重建

kubectl replace --force -f  XXX.yaml

15、Deploy a DaemonSet for FluentD Logging.

Use the given specifications.

Name: elasticsearch

Namespace: kube-system

Image: k8s.gcr.io/fluentd-elasticsearch:1.20
注:因命令集中没有创建daemonset的指令,故而像创建一个deployment,之后再修改deployment的yaml文件中的kind即可
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
16、How many static pods exist in this cluster in all namespaces?
注:static pod的默认路径在/etc/kubernetes/mainfests/下 或查看pod名称,static pod 命名一般会在末尾加上node的名称。
在这里插入图片描述
在这里插入图片描述
17、Create a static pod named static-busybox that uses the busybox image and the command sleep 1000
在这里插入图片描述
在这里插入图片描述
18、We just created a new static pod named static-greenbox. Find it and delete it.

This question is a bit tricky. But if you use the knowledge you gained in the previous questions in this lab, you should be able to find the answer to it.

注:简单的delete命令是无法删除static pod的,他会在你删除后再次自动创建,故而我们需要找到创建的static pod的yaml文件将其清除
首先查看/etc/kubernetes/mainfests下是否存在static-greenbox的yaml文件
在这里插入图片描述
没有,查看此pod在哪个node上
在这里插入图片描述
登录node01节点机器
在这里插入图片描述
查看static pod的路径在哪里
在这里插入图片描述
在这里插入图片描述
到指定文件夹下删除green.yaml文件即可
在这里插入图片描述
回到控制节点查看是否已删除,如下图可见已删除
在这里插入图片描述
19、Let’s create a configmap that the new scheduler will employ using the concept of ConfigMap as a volume.
Create a configmap with name my-scheduler-config using the content of file /root/my-scheduler-config.yaml
在这里插入图片描述
在这里插入图片描述
20、Deploy an additional scheduler to the cluster following the given specification.

Use the manifest file provided at /root/my-scheduler.yaml. Use the same image as used by the default kubernetes scheduler.

首先查看the default kubernetes scheduler.使用的镜像
在这里插入图片描述
修改my-scheduler.yaml文件
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值