In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
The previous article wrote about how to build the image of a reusable tomcat, and this article talked about how to use this image to repeatedly build different projects.
Get to the point:
Step 1 create the corresponding mavn project job
The other configurations remain the same, but the main changes are the actions after the build project.
Note: since there is only one node in my K8s cluster, all pod will be launched on the node node by default, so I will send the build war directly to the node node.
Create a ssh action again
It is important to note that whether it is the path of the server.xml configuration file or the yml configuration file, you must get it right and not mess up.
Master probably means:
First check to see if there is a configmap for the project. If not, create it. If so, there is no action.
Then check to see if the deployment for the project is started, and if not, delete the deployment first, and then create it again. To achieve the restart effect.
Another thing to note here is that if you modify the deployment.yml file, you need to delete the current deployment manually, otherwise an error will be reported.
Deployment.yml is shown below.
# api version number apiVersion: apps/v1# creation type kind: Deployment# description metadata: name: jlj-learning-controller labels: app: jlj-learning-controllerspec:# launch several copies replicas: 1 selector: matchLabels: app: jlj-learning-controller template: metadata: labels: app: jlj-learning-controllerspec:# create 3 volumes volumes: # for storage Put the war package of the project-name: "jlj-learning-controller-war" hostPath: path: "/ Disk/data/tomcat/jlj-learning-controller/code/" # used to store tomcat logs-name: "jlj-learning-controller-log" hostPath: path: "/ Disk/data/tomcat/jlj-learning-controller/log/" # before getting The contents of the server.xml file in the configmap created by the face-name: "jlj-learning-controller-server-xml" configMap: name: jlj-learning-controller.xml items:-key: server.xml path: server.xml containers:-name: jlj-learning-controller image: fushuitong/tomcat:jdk7u21-tomcat7.0.77-cronolog1.6.2 ports: -containerPort: 8080 # Mount 3 volume volumeMounts: # Mount the war package of the project to the webapps directory of tomcat in the container In this way, tomcat loads the project directly at startup, which has been unzipped before. -name: jlj-learning-controller-war mountPath: / usr/local/tomcat/webapps # Mount the local log directory to the logs directory of tomcat in the container, so that all tomcat logs are stored on the host's hard disk, and the deleted logs by the container will not be lost. -name: jlj-learning-controller-log mountPath: / usr/local/tomcat/logs # here focuses on why the container where the server.xml file is mounted is under the configfile directory, because the contents in the original directory of the container will be deleted in this way, # so we mount this server.xml file to the / configfile directory, because in the last build image The action of ln has already been done, so this will be loaded as a configuration file for tomcat. -name: jlj-learning-controller-server-xml mountPath: / configfile
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.