In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Project background
In the following example, Pod contains two containers: tomcat and busybox, which sets Volume "app-logs" at the Pod level for tomcat to write log files to and busybox to read log files.
# cat pod-volume-applogs.yaml apiVersion: v1kind: Podmetadata: name: volume-podspec: containers:-name: tomcat image: tomcat ports:-containerPort: 8080 volumeMounts:-name: app-logs mountPath: / usr/local/tomcat/logs-name: busybox image: busybox command: ["sh", "- c" "tail-f / logs/catalina*.log"] volumeMounts:-name: app-logs mountPath: / logs volumes:-name: app-logs emptyDir: {}
The Volume set here is named app-logs and the type is emptyDir (you can also set it to other types). It is mounted to the / usr/local/tomcat/logs directory in the tomcat container and to the / logs directory in the logreader container. The tomcat container writes files to the / usr/log/tomcat/logs directory after startup, and the logreader container can read the files in it.
You can view the output of the logreader container through the kubectl logs command:
# find /-name app-logs [root@master other] # kubectl logs volume-pod-c busybox26-Jul-2019 1815 06root@master other 22.126 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Djava.protocol.handler.pkgs=org.apache.catalina.webresources26-Jul-2019 18perimeter 06purl 22.126 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Dorg.apache.catalina.security.SecurityListener.UMASK=002726-Jul-2019 18:06: 22.144 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Dignore.endorsed.dirs=26-Jul-2019 18 org.apache.catalina.startup.VersionLoggerListener.log Command line argument 22.144 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument:-Dcatalina.base=/usr/local/tomcat26-Jul-2019 18 org.apache.catalina.startup.VersionLoggerListener.log Command line argument 06 org.apache.catalina.startup.VersionLoggerListener.log Command line argument 22.144 INFO [main].
Log in to the tomcat container to view:
# kubectl exec-it volume-pod-c tomcat-- ls / usr/local/tomcat/logscatalina.2019-07-26.loglocalhost _ access_log.2019-07-26.txthost-manager.2019-07-26.log manager.2019-07-26.loglocalhost.2019-07-26.log# kubectl exec-it volume-pod-c tomcat-- tail / usr/local/tomcat/logs/catalina.2019-07-26.log26-Jul-2019 18 Fran 06Fran 29.935 INFO [localhost-startStop -1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/ usr/local/tomcat/webapps/docs] has finished in [388] ms26-Jul-2019 18 ms26-Jul-2019 06lac 29.936 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/ usr/local/tomcat/webapps/examples] 26-Jul-2019 18Part 06Rd 32.777 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/ usr/local/tomcat
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.