CKA 模拟题库 | 12. 查看Pod日志
发表于|更新于|kubernetesCKA
|总字数:112|阅读时长:1分钟|浏览量:
模拟题目
设置配置环境:
kubectl config use-context k8s
Task
监控 pod foo 的日志并 : 提取与错误 RLIMIT_NOFILE 相对应的日志行 将这些日志行写入 /opt/KUTR00101/foo
参考
kubectl log -h
https://kubernetes.io/zh-cn/docs/tasks/debug/debug-application/debug-running-pod/#examine-pod-logs
解答
考试的时候务必记住切换集群, 注意集群名称 kubectl config use-context k8s
kubectl logs foo | grep -i "RLIMIT_NOFILE" > /opt/KUTR00101/foo |
检查
cat /opt/KUTR00101/foo |
文章作者: Hao
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
相关推荐

2023-01-09
CKA 模拟真题 Killer.sh | Question 15 | Cluster Event Logging
Use context: kubectl config use-context k8s-c2-AC Write a command into /opt/course/15/cluster_events.sh which shows the latest events in the whole cluster, ordered by time ( metadata.creationTimestamp ). Use kubectl for it. Now kill the kube-proxy Pod running on node cluster2-node1 and write the events this caused into /opt/course/15/pod_kill.log . Finally kill the containerd container of the kube-proxy Pod on node cluster2-node1 and write the events into /opt/course/15/container_kill.log . ...

2023-01-09
CKA 模拟真题 Killer.sh | Question 16 | Namespaces and Api Resources
Use context: kubectl config use-context k8s-c1-H Write the names of all namespaced Kubernetes resources (like Pod, Secret, ConfigMap…) into /opt/course/16/resources.txt . Find the project-* Namespace with the highest number of Roles defined in it and write its name and amount of Roles into /opt/course/16/crowded-namespace.txt . 译文将所有命名的 Kubernetes 资源(如 Pod、Secret、ConfigMap……)的名称写入 /opt/course/16/resources.txt 中。 查找定义角色数量最多的 *project-*** 命名空间,并将其名称和角色数量写入 /opt/course/16/crowded-namespace.txt ...

2023-01-02
CKA 模拟题库 | 9. 创建多容器Pod
模拟题目设置配置环境: kubectl config use-context k8s Task按如下要求调度一个Pod: 名称:kucc8 app containers: 2 container 名称/images: nginx consul 参考概念 –> 工作负载 –> Podhttps://kubernetes.io/zh-cn/docs/concepts/workloads/pods/ 解答 考试的时候务必记住切换集群, 注意集群名称 kubectl config use-context k8s vim pod-kucc.yaml apiVersion: v1kind: Podmetadata: name: kucc8spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent - name: consul image: consul imagePullPolicy: IfNotPresent 应用文件 kubec...

2023-01-02
CKA 模拟题库 | 5. 创建 Ingress
模拟题目设置配置环境: kubectl config use-context k8s Task如下创建一个新的nginx Ingress 资源: 名称: ping Namespace: ing-internal 使用服务端口 5678 在路径 /hello 上公开服务 hello 可以使用以下命令检查服务 hello 的可用性,该命令应返回 hello: curl -kL INTERNAL_IP/hello 参考概念 –> 服务、负载均衡和联网 –> Ingresshttps://kubernetes.io/zh-cn/docs/concepts/services-networking/ingress/#the-ingress-resourcehttps://kubernetes.io/zh-cn/docs/concepts/services-networking/ingress/#default-ingress-class 解答方法1 (推荐) 考试的时候务必记住切换集群, 注意集群名称 kubectl config use-context k8s ...

2023-01-09
CKA 模拟真题 Killer.sh | Question 10 | RBAC ServiceAccount Role RoleBinding
Use context: kubectl config use-context k8s-c1-H Create a new ServiceAccount processor in Namespace project-hamster . Create a Role and RoleBinding, both named processor as well. These should allow the new SA to only create Secrets and ConfigMaps in that Namespace. 译文在namespace project-hamster 中创建一个新的 ServiceAccount processor 。创建一个 角色 和 RoleBinding ,这两个都是命名的 processor 。这些应该允许新的 SA 只在该命名空间中创建 Secrets 和 ConfigMaps 。 解答 有4种不同的RBAC组合和3种有效的组合。 Role + RoleBinding(适用于单一命名空间,适用于单个命名空间) ClusterRo...

2023-01-09
CKA 模拟真题 Killer.sh | Question 13 | Multi Containers and Pod shared Volume
Task weight: 4% Use context: kubectl config use-context k8s-c1-H Create a Pod named multi-container-playground in Namespace default with three containers, named c1 , c2 and c3 . There should be a volume attached to that Pod and mounted into every container, but the volume shouldn’t be persisted or shared with other Pods. Container c1 should be of image nginx:1.17.6-alpine and have the name of the node where its Pod is running available as environment variable MY_NODE_NAME. Container c2 should...
评论
公告
站点进行了迁移, 如需帮助, 请发邮件到 [email protected]


