TimesTenオペレータのカスタマイズ

TimesTenオペレータをカスタマイズするには、Kubernetesクラスタ内で実行する、TimesTenオペレータのレプリカ(コピー)の数を指定します。また、イメージ・プル・シークレット、およびTimesTenオペレータのTimesTenコンテナ・イメージの場所と名前を指定する必要があります。

  1. 開発ホストで、kube_files/deployディレクトリに移動します(このディレクトリに移動していない場合)。
    cd kube_files/deploy
  2. テキスト・エディタを使用してoperator.yamlファイルを変更し、次のフィールドを変更します。
    • replicas: 1

      1をTimesTenオペレータのコピー数に置き換えます。開発およびテストの場合は、値1を使用できます。ただし、高可用性を確保する目的で、複数のレプリカを指定できます。

      ノート:

      TimesTenオペレータ・メトリックは、TimesTenオペレータ・デプロイメントに1つのTimesTenオペレータが定義されている場合、正確です。TimesTenオペレータ・メトリックの公開の詳細は、「TimesTen Kubernetesオペレータからのメトリックの公開」を参照してください。
    • sekretを、Kubernetesがレジストリからイメージを取得するために使用するイメージ・プル・シークレットの名前に置き換えます。

    TimesTenコンテナ・イメージの場合:

    • container-registry.oracle.com/timestenを、イメージ・レジストリの場所に置き換えます。この場所は前の手順で決めてあります。「TimesTenコンテナ・イメージについて」を参照してください。この例では、container-registry.oracle.com/timestenを使用します。

    • timesten:22.1.1.19.0を、TimesTenコンテナ・イメージの名前に置き換えてください。この名前は前の手順で決めてあります。「TimesTenコンテナ・イメージについて」を参照してください。この例では、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
    ...
    このoperator.yamlファイルのいくつかのフィールドを見てみましょう。

    ノート:

    operator.yamlファイルは、リリースによって異なる場合があります。
  3. KubernetesクラスタのネームスペースにTimesTenオペレータをデプロイします。
    % kubectl create -f operator.yaml
    deployment.apps/timesten-operator created
    

TimesTenオペレータが正常にデプロイされました。これで、TimesTenオペレータが実行されます。