kubernetesでpodのログを確認する場合、「kubectl logs」コマンドを使用します。
確認するpodは「nginx」です。
1 2 3 4 |
# k get pod nginx NAME READY STATUS RESTARTS AGE nginx 1/1 Running 0 11s # |
試してみましょう。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# kubectl logs nginx /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh /docker-entrypoint.sh: Configuration complete; ready for start up 2022/03/18 09:52:43 [notice] 1#1: using the "epoll" event method 2022/03/18 09:52:43 [notice] 1#1: nginx/1.21.6 2022/03/18 09:52:43 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 2022/03/18 09:52:43 [notice] 1#1: OS: Linux 5.4.0-1065-gcp 2022/03/18 09:52:43 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576 2022/03/18 09:52:43 [notice] 1#1: start worker processes 2022/03/18 09:52:43 [notice] 1#1: start worker process 32 2022/03/18 09:52:43 [notice] 1#1: start worker process 33 # |
pod「nginx」のログが表示されました。