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 as project-regular and work in the project demo-project in the workspace demo-workspace. For more information, see Create Workspaces, Projects, Accounts and Roles.

Hands-on Lab

Step 1: Deploy Tomcat from the App Store

  1. On the Overview page of the project demo-project, click App Store in the top-left corner.

    go-to-app-store

  2. Find Tomcat and click Deploy on the App Information page.

    find-tomcat

    click-deploy

  3. Set a name and select an app version. Make sure Tomcat is deployed in demo-project and click Next.

    click-next

  4. In App Configurations, you can use the default configuration or customize the configuration by editing the YAML file directly. Click Deploy to continue.

    deploy-tomcat

  5. Wait until Tomcat is up and running.

    tomcat-running

Step 2: Access the Tomcat Terminal

  1. Go to Services and click the service name of Tomcat.

    click-tomcat-service

  2. Under Pods, expand the menu to see container details, and then click the Terminal icon.

    tomcat-teminal-icon

  3. You can view deployed projects in /usr/local/tomcat/webapps.

    view-project

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.

  1. Go to Services and click the service name of Tomcat.

    click-tomcat-service

  2. Click More and select Edit Internet Access from the drop-down menu.

    edit-internet-access

  3. Select NodePort for Access Method and click OK. For more information, see Project Gateway.

    nodeport

  4. Under Service Ports, you can see the port is exposed.

    exposed-port

  5. Access the sample Tomcat project through <NodeIP>:<NodePort>/sample in your browser.

    access-tomcat-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.
  6. For more information about Tomcat, refer to the official documentation of Tomcat.


Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.