About Readiness Probes for TimesTen Containers
Kubernetes readiness probes allow Kubernetes to determine whether a particular application is ready. For example, consider an application that, when it starts, has to perform a lengthy startup procedure. When the application is started by Kubernetes, it is not immediately ready. It cannot handle requests or workloads until the startup procedure is complete.
The TimesTen Kubernetes Operator (TimesTen Operator) provides two readiness probes for two different definitions of the term readiness. In order to determine if a TimesTen container is ready to Kubernetes in each of these different situations, the TimesTen Operator creates and manages two files in TimesTen containers. The presence or absence of one or more of these files indicates if TimesTen in that container is ready or not.
Let's take a look at these two definitions and the specific TimesTen readiness probe file that is applicable for each definition. After reviewing the definitions, choose if either of these definitions is applicable to your situation and is useful for you. You can only choose one of these definitions.
-
The first definition defines readiness for both TimesTen Classic and TimesTen Scaleout databases. In a TimesTen Classic active standby pair, the
tt
container providing the active database is considered ready. In TimesTen Scaleout, all instances with elements that are up and usable are considered ready.For this definition of readiness, the TimesTen Operator creates and manages the
/tmp/active
file, which is located in the TimesTen container's file system. If this file exists in the container, the container is. Otherwise, the container is not ready. -
The second definition defines readiness specifically for TimesTen Classic databases. In TimesTen Classic, a TimesTen instance that is created by the TimesTen Operator and is running in the
tt
container of a Pod is ready if the database inside of that Pod is loaded, replication is configured, and the database is either a fully functional active or a fully functional standby. A database that is down or in the process of being created or duplicated is not ready.For this definition of readiness, the TimesTen Operator creates and manages the
/tmp/readiness
file, which is located in the TimesTen container's file system. If the file exists in the container, the container is ready to Kubernetes. Otherwise, the container is not ready.
sample
TimesTenClassic object definition includes a TimesTen readiness probe. Kubernetes runs the cat
command in the tt
container every 10
seconds. If the command exits with a return code of 0
, the container is ready. If the command returns any other value, the container is not ready.apiVersion: timesten.oracle.com/v1
kind: TimesTenClassic
metadata:
name: sample
spec:
ttspec:
…
template:
spec:
…
containers:
- name: tt
readinessProbe:
exec:
command:
- cat
- /tmp/readiness
failureThreshold: 1
periodSeconds: 10
successThreshold: 1
Let's discuss these readiness probes in more detail and let's look at specific use cases.