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-02
KA 模拟题库 | 1. 权限控制RBAC
设置配置环境kubectl config use-context k8s Context为部署流水线创建一个新的 ClusterRole 并将其绑定到范围为特定的 namespace 的特定 ServiceAccount 。 Task创建一个名为 deployment-clusterrole 且仅允许创建以下资源类型的新 ClusterRole : Deployment StatefulSet DaemonSet 在现有的 namespace app-team1 中创建一个名为 cicd-token 的新 ServiceAccount。 限于 namespace app-team1 中,将新的 ClusterRole deployment-clusterrole 绑定到新的 ServiceAccount cicd-token 参考kubectl create clusterrole -hkubectl create rolebinding -hhttps://kubernetes.io/zh-cn/docs/reference/access-authn-authz/rbac...

2023-01-10
CKA 模拟真题 Killer.sh | Preview Question 3
Use context: kubectl config use-context k8s-c2-AC Create a Pod named check-ip in Namespace default using image httpd:2.4.41-alpine . Expose it on port 80 as a ClusterIP Service named check-ip-service . Remember/output the IP of that Service. Change the Service CIDR to 11.96.0.0/12 for the cluster. Then create a second Service named check-ip-service2 pointing to the same Pod to check if your settings did take effect. Finally check if the IP of the first Service has changed. 译文在命名空间defa...

2023-01-02
CKA 模拟题库 | 17. 节点维护
模拟题目设置配置环境: kubectl config use-context ek8s Task将名为 node02 的 node 设置为 不可用,并重新调度该 node 上所有运行的 pods。 参考任务 –> 管理集群 –> 安全地清空一个节点https://kubernetes.io/zh-cn/docs/tasks/administer-cluster/safely-drain-node/ 解答 考试的时候务必记住切换集群, 注意集群名称 kubectl config use-context k8s kubectl get nodeskubectl cordon node02kubectl get nodeskubectl drain node02 --ignore-daemonsets --delete-emptydir-data --force 检查kubectl get nodekubectl get pod -A -o wide | grep node02

2023-01-09
CKA 模拟真题 Killer.sh | Question 8 | Get Controlplane Information
Use context: kubectl config use-context k8s-c1-H Ssh into the controlplane node with ssh cluster1-controlplane1 . Check how the controlplane components kubelet, kube-apiserver, kube-scheduler, kube-controller-manager and etcd are started/installed on the controlplane node. Also find out the name of the DNS application and how it’s started/installed on the controlplane node. Write your findings into file /opt/course/8/controlplane-components.txt . The file should be structured like...

2023-01-10
CKA 模拟真题 Killer.sh | Question 18 | Fix Kubelet
Use context: kubectl config use-context k8s-c3-CCC There seems to be an issue with the kubelet not running on cluster3-node1 . Fix it and confirm that cluster has node cluster3-node1 available in Ready state afterwards. You should be able to schedule a Pod on cluster3-node1 afterwards. Write the reason of the issue into /opt/course/18/reason.txt . 译文在 cluster3-node1 上运行的 kubelet 似乎有问题。 修复该问题并确认集群中的 cluster3-node1 节点处于就绪状态。 之后,您应该可以在 cluster3-node1 上调度 Pod。 将问题原因写入 /opt/course/18/reason.txt 。...

2023-01-09
CKA 模拟真题 Killer.sh | Question 3 | Scale down StatefulSet
Use context: kubectl config use-context k8s-c1-H There are two Pods named o3db-** in Namespace project-c13. C13 management asked you to scale the Pods down to one replica to save resources. 译文名称空间 project-c13 中有两个名为 o3db-** 的Pod。C13管理层要求你将Pods缩减到一个副本,以节省资源。 解答检查pods k -n project-c13 get pod | grep o3db 检查常用资源 k -n project-c13 get deploy,ds,sts | grep o3db 查看pod标签,可以看到statefulset字段 k -n project-c13 get pod --show-labels | grep o3db 对statefulset中3db进行缩容 k -n project-c13 scale sts o3...
评论
公告
站点进行了迁移, 如需帮助, 请发邮件到 admin@hao.kim


