tomcat

by KubeSphere

Helm chartv0.4.3App 8.5.41Verified publisher

Deploy a basic tomcat application server with sidecar as web archive container

About this chart

Forked from https://github.com/helm/charts.

Changes to the official chart:

  • Use Tomcat 8.5 instead of Tomcat 7.0
  • Use ClusterIP instead of LoadBalancer
  • Use Alpine image to reduce volume usage

Tomcat

Tomcat is is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies.

Introduction

This chart creates a tomcat application server Deployment, plus http Services for the server. The chart offers an optimization for application updates running in a servlet container-type engines like tomcat and Jboss. The chart uses the WAR, EAR, and other deployable components outside of the Servlet engine as sidecar container so application upgrades requires the sidecar container image only to be updated and not the Servlet engine as if both would run at the same image.

Prerequisites

  • Kubernetes 1.10+

Provider-specific Prerequisites

Installing the Chart

To install the chart with the release name my-release:

$ helm install --name my-release stable/tomcat

This command deploys a tomcat dedicated server with sane defaults.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the tomcat chart and their default values.

ParameterDescriptionDefault
image.webarchive.repositorySidecar image source repository nameananwaresystems/webarchive
image.webarchive.tagwebarchive release tag.1.0
image.tomcat.repositoryTomact image source repository nametomcat
image.tomcat.tagtomcat release tag.7.0
image.pullPolicyImage pull policyIfNotPresent
image.pullSecretsImage pull secrets[]
deploy.directoryWebarchive deployment directory/usr/local/tomcat/webapps
envEnvironment variables[]
extraVolumesExtra volumes[]
extraVolumeMountsExtra volume mounts[]
extraInitContainersExtra init containers[]
hostPorthostPort8009
service.nameTomcat service namehttp
service.externalPortKubernetes service port80
service.internalPortTomcat front port8080
service.typeKubernetes service typeLoadBalancer
readinessProbe.pathHTTP path to check for readiness/sample
livenessProbe.pathHTTP path to check for readiness/sample
resourcesCPU/Memory resource requests/limits{}
nodeSelectorNode affinity{}
tolerationsNode tolerations{}

Refer to values.yaml for the full run-down on defaults. These are a mixture of Kubernetes and tomcat-related directives that map to environment variables.

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

$ helm install --name my-release \
  --set Values.someval=My Server,ImageTag=1.0 \
    stable/tomcat

The above command deploys Tomcat dedicated with a server name of My Server and docker-tomcat image version 1.0.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

$ helm install --name my-release -f values.yaml stable/stable

Tip: You can use the default values.yaml

Persistence

"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."

Credits

Java Web Application with Tomcat and Sidecar Container

Deploy tomcat with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has tomcat on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the charttomcat is pinned at v0.4.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply