Kubernetes cluster deployment Tomcat container/java Web application process-docker CP approach

Source: Internet
Author: User
Tags java web docker cp
Kube-tomcat.yaml is implemented as follows. Here is the implementation of deployment and services in a single file. can also be divided into two files to implement. # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # You could not use this file, except in compliance with the License. # You may obtain a copy of the License in # # http://www.apache.org/licenses/LICENSE-2.0 # unless required by appli Cable or agreed to in writing, software # Distributed under the License was distributed on ' as is ' basis, # without Warranties or CONDITIONS of any KIND, either express OR implied. # The License for the specific language governing permissions and # Limitations under the License.
# Configuration to deploy release version of the Dashboard UI. # # Example Usage:kubectl create-f <this_file>
Kind:deployment apiversion:extensions/v1beta1 metadata:   labels:     app: Kube-tomcat     version:v1.1.1   name:kube-tomcat   namespace:default Spec :   replicas:1   selector:     matchlabels:        app:kube-tomcat   template:     metadata:        labels:         app:kube-tomcat     spec:       containers:       -name:kube-tomcat          image:docker.io/chenyufeng/tomcat-centos          imagepullpolicy:always         ports:          -containerport:8080         & nbSp; protocol:tcp         args:            # uncomment the following line to manually specify Kubernetes API server Host &NBSP;&NBSP;&NBSP;&N bsp;      # If not specified, Dashboard'll attempt to auto discover the API server and con Nect           # to it. Uncomment only if the default is does not work.         ---apiserver-host=http://47.97.90.38:8080  ## Please revise for your own kube-apiserver         livenessprobe:            httpget:              path:/            port:8080            initialdelayseconds:30    &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;TIMEOUTSECONDS:30---kind:service apiversion:v1 metadata:    Labels:     app:kube-tomcat   name:kube-tomcat   namespace:default Spec: & Nbsp; type:nodeport   ports:   -port:80     targetport:8080    selector:     app:kube-tomcat
The complete documentation is as follows:
In Master, and then use the following command to create the deployment and service Kubectl create-f Kube-tomcat.yaml
View the created Deployment:kubectl get deployment


See the details of this deployment: Kubectl describe deployment Kube-tomcat


View the created Service:kubectl get service

View the details of this service. Kubectl describe service Kube-tomcat service details the IP here is Cluster-ip. Cluster-ip is bound to the service. Service details the port here is the service's port number. Service details The Nodeport here is the true port number of node. Service details the endpoints here is the IP and port of the container.

View the created Pod:kubectl get pod


See the details of one of the pods. Pod details here The IP is the virtual IP in the nodes. The virtual IP can go to nodes inside using Ifconfig view. Kubectl describe pod Kube-tomcat-1115055280-tk1f8



In nodesTo view the created container:
Then use the browser to access: http://47.97.90.38:8080/api/v1/proxy/namespaces/default/services/kube-tomcat/ Be sure to specify namespaces and services here.
and then to nodes, the war using "Docker CP" copy to the container's Tomcat/webapps, you can achieve the page access to "here may need to wait more time, at least a few minutes" test in postman note that the IP in the request should be the IP of master. Return success. You can use postman to perform interface testing by indicating successful deployment.

The above steps can also be deployed in conjunction with continuous integration CI/CD, simplifying a number of processes.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.