Skip to main content

Installation with Kubernetes

Since Txture is offered as a container, it can be operated on Kubernetes easily. The following guide details some steps to install Txture on a Kubernetes cluster.

Prerequisites

This guide has a couple of prerequisites and assumptions:

  • The configuration files assume that the PostgreSQL server will be run as a container alongside Txture. This is not strictly necessary as any other deployment of a PostgreSQL server (e.g. DBaaS or central service) works equally well. If that is the case, remove the PostgreSQL section from the following suggested configuration files.
  • A working Kubernetes cluster and kubectl set up locally.
  • Initial contents for txture_home (typically provided by Txture)

Configuration files

The first configuration file contains the workloads and service needed for Txture and the PostgreSQL database:

apiVersion: v1
kind: Service
metadata:
name: txture
spec:
ports:
- port: 8080
selector:
app: txture
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: txture
spec:
selector:
matchLabels:
app: txture
strategy:
type: Recreate
template:
metadata:
labels:
app: txture
spec:
containers:
- image: postgres:15-bullseye
name: postgres15
args: ['-c', 'log_destination=jsonlog']
env:
# Use secret in real usage
- name: POSTGRES_USER
value: txture
- name: POSTGRES_PASSWORD
value: pleaseuseaproperypasswordhere
- name: POSTGRES_DB
value: txture
ports:
- containerPort: 5432
name: txture-db
volumeMounts:
- name: txture-db-volume
mountPath: /opt/txture-postgres
- image: europe-docker.pkg.dev/txture/production/txture:latest
name: txture
command: ['/bin/sh', '-c']
args: ['until [ -f /opt/txture_home/txture.properties ]; do sleep 5; done && catalina.sh run']
env:
- name: CATALINA_OPTS
value: -DtxtureHome=/opt/txture_home -Xmx8000m -Xms8000m -server -Dio.grpc.netty.shaded.io.netty.transport.noNative=true
resources:
limits:
memory: '9000Mi'
ports:
- containerPort: 8080
name: txture
volumeMounts:
- name: txture-home
mountPath: /opt/txture_home
volumes:
- name: txture-db-volume
persistentVolumeClaim:
claimName: txture-db-claim
- name: txture-home
persistentVolumeClaim:
claimName: txture-home-claim

In addition, two persistent volume claims will need to be created (one for Txture, one for PostgreSQL):

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: txture-home-claim
spec:
storageClassName: standard-rwo
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: txture-db-claim
namespace: default
spec:
storageClassName: standard-rwo
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

Please note that the storageClassName will likely need to be adapted to your Kubernetes clusters. The values provided work for Google Kubernetes Engine (GKE).

Deploying the pods

Put the two .yaml files in a single directory (e.g. txture-kubernetes) of your choice. The .yaml files will create one service and two persistent volumes (one for the txture_home folder, the other for the postgres database). You can configure the database password and user in the txture.yaml file.

Once you're happy with the configuration, deploy everything with

kubectl apply -f txture-kubernetes/

Txture will not start until you upload the txture_home to the volume. Specifically, there is a check before the startup that waits until the file /opt/txture_home/txture.properties is present.

Uploading your txture_home directory

First, make sure the configuration in the txture.properties file is correct. Most importantly, make sure that the JDBC connection string matches your PostgreSQL configuration. You can then upload the txture_home folder using kubectl cp.

In order to be able to upload, you'll need to get the pod name first. You can fetch that information with

kubectl get pods

which should show you an output such as this

NAME                                                READY   STATUS    RESTARTS      AGE
txture-5bdb8cd8d5-9zn6z 1/1 Running 0 32m

You can then copy the folder to the txture container running in the pod with

kubectl cp txture_home/ txture-5bdb8cd8d5-9zn6z:/opt/ -c txture

Once the files required by txture are uploaded, it will start. This might take a few minutes. You can check the logs of your Kubernetes workloads to see the progress.

Accessing your Txture instance

Once Txture has started successfully, you can access it using kubectl port-forwarding. The port of Txture is set in the txture.yaml Kubernetes file. You can then forward the port using the pod name once more.

kubectl port-forward txture-5bdb8cd8d5-9zn6z 8080:8080

This will map the service's port to your localhost. You can then access the Txture instance at localhost:8080 and log in using the password you set.

Production setup

While the above sets up a Txture instance, you might want to add some more configurational details and additions. They have been left out in the above example for simplicity, but production setups might require one or more of these:

  • Reverse proxy or ingress to handle TLS
  • Security settings such as CAP_DROP