You are viewing documentation for KubeSphere version:v3.0.0
KubeSphere v3.0.0 documentation is no longer actively maintained. The version you are currently viewing is a static snapshot. For up-to-date documentation, see the latest version.
Deploy Tomcat on KubeSphere
Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. Tomcat provides a pure Java HTTP web server environment in which Java code can run.
This tutorial walks you through an example of deploying Tomcat from the App Store of KubeSphere.
Prerequisites
- Please make sure you enable the OpenPitrix system.
- You need to create a workspace, a project, and a user account for this tutorial. The account needs to be a platform regular user and to be invited as the project operator with the
operator
role. In this tutorial, you log in asproject-regular
and work in the projectdemo-project
in the workspacedemo-workspace
. For more information, see Create Workspaces, Projects, Accounts and Roles.
Hands-on Lab
Step 1: Deploy Tomcat from the App Store
-
On the Overview page of the project
demo-project
, click App Store in the top left corner. -
Find Tomcat and click Deploy on the App Info page.
-
Set a name and select an app version. Make sure Tomcat is deployed in
demo-project
and click Next. -
In App Config, you can use the default configuration or customize the configuration by editing the YAML file directly. Click Deploy to continue.
-
Wait until Tomcat is up and running.
Step 2: Access the Tomcat Terminal
-
Go to Services and click the service name of Tomcat.
-
Under Pods, expand the menu to see container details, and then click the Terminal icon.
-
You can view deployed projects in
/usr/local/tomcat/webapps
.
Step 3: Access a Tomcat Project from Your Browser
To access a Tomcat project outside the cluster, you need to expose the app through a NodePort first.
-
Go to Services and click the service name of Tomcat.
-
Click More and select Edit Internet Access from the drop-down menu.
-
Select NodePort for Access Method and click OK. For more information, see Project Gateway.
-
Under Service Ports, you can see the port is exposed.
-
Access the sample Tomcat project through
{$NodeIP}:{$Nodeport}
in your browser.Note
You may need to open the port in your security groups and configure related port forwarding rules depending on your where your Kubernetes cluster is deployed. -
For more information about Tomcat, refer to the official documentation of Tomcat.