ibm-websphere-liberty
by Helm
WebSphere Liberty is a fast, dynamic, and easy-to-use Java application server.
About this chart
WebSphere Liberty Helm Chart
Introduction
WebSphere Liberty is a fast, dynamic, and easy-to-use Java EE application server. Ideal for developers, but also ready for production, Liberty is a combination of IBM technology and open source software, with fast startup times (<2 seconds), and a simple XML configuration. All in a package that's <70 MB to download. You can be developing applications in no time. With a flexible, modular runtime, you can download additional features from the Liberty Repository or strip it back to the essentials for deployment into production environments. Everything in Liberty is designed to help you get your job done how you want to do it.
Resources Required
System resources
- CPU Requested : 500m (500 millicpu)
- Memory Requested : 512Mi (~ 537 MB)
Storage
A persistent volume is required, if you plan on using the transaction service within Liberty. The server.xml Liberty configuration file must be configured to place the transaction log on this volume so that it persists, if the server fails and restarts.
Accessing WebSphere Liberty
From a browser, use http://external-ip:nodeport to access the application.
Chart Details
- Installs one
DeploymentorStatefulSetrunning WebSphere Liberty image - Installs a
Serviceand optionally anIngressto route traffic to WebSphere Liberty server - Optionally persistence can be configured to retain server logs and transaction logs
Prerequisites
WebSphere Liberty Docker image requirements
WebSphere Liberty Docker images based on Universal Base Images (UBI) are publicly available from Docker hub and used by chart as default. Our Docker images for Ubuntu are also publicly available from our Docker Hub page. Ensure your Kubernetes environment has set the image enforcement policy appropriately to allow access to those repositories. See Enforcing container image security for more information.
The Helm chart requires the Docker image to have certain directories linked. The websphere-liberty image from Docker Hub will already have the expected links. If you are not using that image, either directly or as parent image, then you must add the following to your Dockerfile:
ENV LOG_DIR /logs
ENV WLP_OUTPUT_DIR /opt/ibm/wlp/output
RUN mkdir /logs \
&& ln -s $WLP_OUTPUT_DIR/defaultServer /output \
&& ln -s /opt/ibm/wlp/usr/servers/defaultServer /config
Configuration values related to monitoring, health, JMS, IIOP, HTTP and SSL require the Liberty server to be configured appropriately at Docker image layer. See WASDev/ci.docker for more information.
PodSecurityPolicy Requirements
This chart requires a PodSecurityPolicy to be bound to the target namespace prior to installation. Choose either a predefined PodSecurityPolicy or have your cluster administrator create a custom PodSecurityPolicy for you:
- Predefined PodSecurityPolicy name:
ibm-restricted-psp - Custom PodSecurityPolicy definition:
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: ibm-websphere-liberty-psp
spec:
allowPrivilegeEscalation: false
forbiddenSysctls:
- '*'
fsGroup:
ranges:
- max: 65535
min: 1
rule: MustRunAs
requiredDropCapabilities:
- ALL
runAsUser:
rule: MustRunAsNonRoot
seLinux:
rule: RunAsAny
supplementalGroups:
ranges:
- max: 65535
min: 1
rule: MustRunAs
volumes:
- configMap
- emptyDir
- projected
- secret
- downwardAPI
- persistentVolumeClaim
- Custom ClusterRole for the custom PodSecurityPolicy:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ibm-websphere-liberty-clusterrole
rules:
- apiGroups:
- extensions
resourceNames:
- ibm-websphere-liberty-psp
resources:
- podsecuritypolicies
verbs:
- use
Configuration scripts can be used to create the required resources
Download the following scripts located at /ibm_cloud_pak/pak_extensions/pre-install directory.
-
The pre-install instructions are located at
clusterAdministration/createSecurityClusterPrereqs.shfor cluster admins to create the PodSecurityPolicy and ClusterRole for all releases of this chart. -
The namespace scoped instructions are located at
namespaceAdministration/createSecurityNamespacePrereqs.shfor team admin/operator to create the RoleBinding for the namespace. This script takes one argument; the name of a pre-existing namespace where the chart will be installed.- Example usage:
./createSecurityNamespacePrereqs.sh myNamespace
- Example usage:
Configuration scripts can be used to clean up resources created
Download the following scripts located at /ibm_cloud_pak/pak_extensions/post-delete directory.
-
The post-delete instructions are located at
clusterAdministration/deleteSecurityClusterPrereqs.shfor cluster admins to delete the PodSecurityPolicy and ClusterRole for all releases of this chart. -
The namespace scoped instructions are located at
namespaceAdministration/deleteSecurityNamespacePrereqs.shfor team admin/operator to delete the RoleBinding for the namespace. This script takes one argument; the name of the namespace where the chart was installed.- Example usage:
./deleteSecurityNamespacePrereqs.sh myNamespace
- Example usage:
Red Hat OpenShift SecurityContextConstraints Requirements
This chart requires a SecurityContextConstraints to be bound to the target namespace prior to installation. To meet this requirement there may be cluster scoped as well as namespace scoped pre and post actions that need to occur.
The predefined SecurityContextConstraints name: ibm-restricted-scc has been verified for this chart, if your target namespace is bound to this SecurityContextConstraints resource you can proceed to install the chart.
Creating the required resources
This chart defines a custom SecurityContextConstraints which can be used to finely control the permissions/capabilities needed to deploy this chart. You can enable this custom SecurityContextConstraints resource using the supplied instructions or scripts in the pak_extensions/pre-install directory.
-
From the user interface, you can copy and paste the following snippets to enable the custom
SecurityContextConstraints- Custom
SecurityContextConstraintsdefinition:
apiVersion: security.openshift.io/v1 kind: SecurityContextConstraints metadata: annotations: name: ibm-websphere-liberty-scc allowHostDirVolumePlugin: false allowHostIPC: false allowHostNetwork: false allowHostPID: false allowHostPorts: false allowPrivilegedContainer: false allowedCapabilities: [] allowedFlexVolumes: [] defaultAddCapabilities: [] fsGroup: type: MustRunAs ranges: - max: 65535 min: 1 readOnlyRootFilesystem: false requiredDropCapabilities: - ALL runAsUser: type: MustRunAsNonRoot seccompProfiles: - docker/default seLinuxContext: type: RunAsAny supplementalGroups: type: MustRunAs ranges: - max: 65535 min: 1 volumes: - configMap - downwardAPI - emptyDir - persistentVolumeClaim - projected - secret priority: 0 - Custom
-
From the command line, you can run the setup scripts included under
pak_extensions/pre-installAs a cluster admin the pre-install instructions are located at:pre-install/clusterAdministration/createSecurityClusterPrereqs.sh
As team admin the namespace scoped instructions are located at:
pre-install/namespaceAdministration/createSecurityNamespacePrereqs.sh
Limitations
See RELEASENOTES.md
Installing the Chart
The Helm chart has the following values that can be overridden by using --set name=value. For example:
helm repo add ibm-charts https://raw.githubusercontent.com/IBM/charts/master/repo/stable/helm install --name my-release --set resources.constraints.enabled=true --set autoscaling.enabled=true --set autoscaling.minReplicas=2 ibm-charts/ibm-websphere-liberty --tls
Resource constraints can be enabled using resources.constraints.enabled parameter. Required resource can be configured using resources.requests.cpu and resources.requests.memory parameters. Resource limits can be configured using resources.limits.cpu and resources.limits.memory parameters. Review the default values specified by the chart and adjust according to your needs. It is recommended not to use Xmx or Xms. Use –XX:MaxRAMPercentage and –XX:InitialRAMPercentage for any fine tuning, such as if there are other processes set to run in the same container.
Verifying the Chart
See the instruction after the helm installation completes for chart verification. The instruction can also be displayed by viewing the installed helm release under Menu -> Workloads -> Helm Releases or by running the command: helm status my-release --tls
Uninstalling the Chart
To uninstall/delete the my-release deployment:
helm delete my-release --purge --tls
This command removes all the Kubernetes components associated with the chart, except any persistent volume claims (PVCs) which is created when logs.persistLogs or logs.persistTransactionLogs is set to true. This is the default behavior of Kubernetes, and ensures that valuable data is not deleted. In order to delete the server data, you can delete the PVC using the following command:
kubectl delete pvc my-pvc
Note: You can use kubectl get pvc to see the list of available PVCs.
Configuration
| Qualifier | Parameter | Definition | Allowed Value |
|---|---|---|---|
image | pullPolicy | Image Pull Policy | Always, Never, or IfNotPresent. Defaults to Always if :latest tag is specified, or IfNotPresent otherwise. See Kubernetes - Updating Images |
repository | Name of image, including repository prefix (if required). | See Docker - Extended tag description | |
tag | Docker image tag. | See Docker - Tag | |
pullSecret | Image pull secret, if using a Docker registry that requires credentials. | See Kubernetes - ImagePullSecrets | |
license | The license state of the image being deployed. | Empty (default) for development. accept if you have previously accepted the production license. | |
readinessProbe | Configure when container is ready to start accepting traffic. Use this to override the default readiness probe configuration. See Configure Liveness and Readiness Probes for more information. | YAML object of readiness probe | |
livenessProbe | Configure when to restart container. Use this to override the default liveness probe configuration. See Configure Liveness and Readiness Probes for more information. | YAML object of liveness probe | |
extraEnvs | Extra environment variables for the image. | YAML array of environment variables | |
lifecycle | Handlers for the PostStart and PreStop lifecycle events of container. | YAML object of lifecycle handlers | |
serverOverridesConfigMapName | Name of the ConfigMap that contains server configuration overrides (within key 'server-overrides.xml') to configure your Liberty server at deployment. | Name of ConfigMap | |
extraVolumeMounts | Additional volumeMounts for server pods | YAML array of volumeMounts definitions | |
security | Configure the security attributes of the image | YAML object of security attributes | |
resourceNameOverride | This name will be appended to the release name to form the name of resources created by the chart. By default, this is set to the chart name. | ||
deployment | annotations | Additional annotations to be added to Deployment (or StatefulSet if persistence is enabled) | YAML object of annotations |
labels | Additional labels to be added to Deployment (or StatefulSet if persistence is enabled) | YAML object of labels | |
pod | annotations | Additional annotations to be added to pods | YAML object of annotations |
labels | Additional labels to be added to pods | YAML object of labels | |
extraInitContainers | Additional Init Containers which are run before the containers are started | YAML array of initContainers definitions | |
extraContainers | Additional containers to be added to the server pods | YAML array of containers definitions | |
extraVolumes | Additional volumes for server pods | YAML array of volume definitions | |
security | Configure the security attributes of the pod | YAML object of security attributes | |
extraNodeSelectorRequirements | Additional node selector expressions to require before selecting a node for pods. Note that these will need to be satisfied in addition to |
Deploy ibm-websphere-liberty with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has ibm-websphere-liberty 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartibm-websphere-liberty is pinned at v1.10.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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