- Kubernetes Operator User's Guide
- Set Up the Environment
- Customize the TimesTen Operator
Customize the TimesTen Operator
You can customize the TimesTen Operator by specifying the number of replicas (copies) of the TimesTen Operator that you want running in your Kubernetes cluster. You also must provide the image pull secret, and the location and name of the TimesTen container image for the TimesTen Operator.
- On your development host, change to the
kube_files/deploy
directory (if not already in this directory).cd kube_files/deploy
- Use a text editor to modify the
operator.yaml
file, making changes to these fields:-
replicas:
1
Replace
1
with the number of copies of the TimesTen Operator. A value of1
is acceptable for development and testing. However, you can specify more than one replica for high availability purposes.Note:
TimesTen Operator metrics are accurate when you have one TimesTen Operator defined in your TimesTen Operator Deployment. For more information about exposing TimesTen Operator metrics, see Expose Metrics from the TimesTen Kubernetes Operator. -
Replace
sekret
with the name of the image pull secret that Kubernetes uses to pull images from your registry.
For the TimesTen container image:
-
Replace
container-registry.oracle.com/timesten
with the location of your image registry. You determined this location in a previous step. See About TimesTen Container Images. This example usescontainer-registry.oracle.com/timesten
. -
Replace
timesten:22.1.1.19.0
with the name of the TimesTen container image. You determined this name in a previous step. See About TimesTen Container Images. This example usestimesten:22.1.1.19.0
.
vi operator.yaml # Copyright (c) 2019 - 2023, Oracle and/or its affiliates. apiVersion: apps/v1 kind: Deployment metadata: name: timesten-operator spec: replicas: 1 selector: matchLabels: name: timesten-operator template: metadata: labels: name: timesten-operator spec: serviceAccountName: timesten-operator imagePullSecrets: - name: sekret containers: - name: timesten-operator image: container-registry.oracle.com/timesten/timesten:22.1.1.19.0 command: - /timesten/operator/operator/timesten-operator ports: - name: probes containerPort: 8081 protocol: TCP - name: metrics containerPort: 8080 protocol: TCP readinessProbe: httpGet: scheme: HTTP path: /healthz port: probes initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 10 successThreshold: 1 failureThreshold: 1 livenessProbe: httpGet: scheme: HTTP path: /healthz port: probes initialDelaySeconds: 10 periodSeconds: 30 timeoutSeconds: 10 successThreshold: 1 failureThreshold: 3 env: - name: WATCH_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: OPERATOR_NAME value: "timesten-operator" - name: TT_DEBUG value: "0" - name: EXPOSE_METRICS value: "1" - name: METRICS_SCHEME value: "https" - name: EXPOSE_PROBES value: "1" - name: CREATE_SERVICEMONITOR value: "1" resources: requests: cpu: "250m" memory: "1G" limits: cpu: "250m" memory: "1G" securityContext: runAsNonRoot: true privileged: false allowPrivilegeEscalation: false capabilities: drop: - all ...
Let's take a look at some of the fields in thisoperator.yam
l file.-
The name of the TimesTen Operator Deployment is
timesten-operator
. -
The default value for
replicas
is1
. The value is not changed in the example. -
The image pull Secret is
sekret
. The value is not changed in the example. -
The image is
container-registry.oracle.com/timesten/timesten:22.1.1.19.0
. This example uses thecontainer-registry.oracle.com/timesten
repository. The name of the offical TimesTen container image istimesten:22.1.1.19.0
to reflect the22.1.1.19.0
TimesTen release. -
The TimesTen Operator's readiness and liveness probes are included in the
operator.yaml
file. These probes allow Kubernetes to determine the health of the TimesTen Operator. See About Readiness and Liveness Probes. -
The following TimesTen Operator environment variables are included in the
operator.yaml
file.-
EXPOSE_METRICS
: A value of"1"
indicates that TimesTen Operator metrics are exposed. This is the default. For more information about TimesTen Operator metrics, see Expose Metrics from the TimesTen Kubernetes Operator and TimesTen Kubernetes Operator Environment Variables. METRICS_SCHEME
: A value of"https"
indicates TimesTen Operator metrics are exposed using https. This is the default. For more information about TimesTen Operator metrics, see Expose Metrics from the TimesTen Kubernetes Operator and TimesTen Kubernetes Operator Environment Variables.-
EXPOSE_PROBES
: A value of"1"
indicates that TimesTen Operator probes are exposed. This is the default. For more information, see About Readiness and Liveness Probes and TimesTen Kubernetes Operator Environment Variables. -
CREATE_SERVICEMONITOR
: A value of"1"
indicates that the TimesTen Operator creates aSERVICEMONITOR
object. This is the default. For more information, see Expose Metrics from the TimesTen Kubernetes Operator and TimesTen Kubernetes Operator Environment Variables.
-
-
There are default CPU and memory requests and limits provided in the
operator.yaml
file.
Note:
Theoperator.yaml
file can change from release to release. -
- Deploy the TimesTen Operator in the namespace of your Kubernetes cluster.
% kubectl create -f operator.yaml deployment.apps/timesten-operator created
You successfully deployed the TimesTen Operator. The TimesTen Operator should now be running.