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.

  1. On your development host, change to the kube_files/deploy directory (if not already in this directory).
    cd kube_files/deploy
  2. 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 of 1 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 uses container-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 uses timesten: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 this operator.yaml file.

    Note:

    The operator.yaml file can change from release to release.
  3. 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.