题目主干

Task
监控 pod foo 的日志并:
提取与错误 RLIMIT_NOFILE相对应的日志行
将这些日志行写入 /opt/KUTR00101/foo

参考说明

题目解答

  1. student@master01:~$ kubectl get pod
  2. NAME READY STATUS RESTARTS AGE
  3. 11-factor-app 1/1 Running 6 (21d ago) 70d
  4. foo 1/1 Running 6 (21d ago) 70d
  5. front-end-dd8dd7c-pqclp 1/1 Running 0 10m
  6. nginx 1/1 Running 0 52m
  7. nginx-kusc00401 1/1 Running 0 50m
  8. presentation-5649f596b9-jxfnn 1/1 Running 6 (21d ago) 70d
  9. presentation-5649f596b9-nztgp 1/1 Running 0 5h35m
  10. presentation-5649f596b9-p27s8 1/1 Running 0 5h35m
  11. presentation-5649f596b9-tqql2 1/1 Running 0 5h35m
  12. student@master01:~$ kubectl logs foo
  13. /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
  14. /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
  15. /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
  16. 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
  17. 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
  18. /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
  19. /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
  20. /docker-entrypoint.sh: Configuration complete; ready for start up
  21. 2022/05/05 02:32:55 [notice] 1#1: using the "epoll" event method
  22. 2022/05/05 02:32:55 [notice] 1#1: nginx/1.21.5
  23. 2022/05/05 02:32:55 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
  24. 2022/05/05 02:32:55 [notice] 1#1: OS: Linux 5.4.0-100-generic
  25. 2022/05/05 02:32:55 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
  26. 2022/05/05 02:32:55 [notice] 1#1: start worker processes
  27. 2022/05/05 02:32:55 [notice] 1#1: start worker process 32
  28. 2022/05/05 02:32:55 [notice] 1#1: start worker process 33
  29. student@master01:~$ kubectl logs foo |grep RLIMIT_NOFILE
  30. 2022/05/05 02:32:55 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
  31. student@master01:~$
  32. student@master01:~$ kubectl logs foo |grep RLIMIT_NOFILE > /opt/KUTR00101/foo
  33. student@master01:~$ cat /opt/KUTR00101/foo
  34. student@master01:~$