コンテンツにスキップ

Deploymentリソースの設定

config-deployment ConfigMap(Deployment ConfigMapと呼ばれる)には、Knativeサービスを支えるKubernetes Deployment リソースの構成方法を決定する設定が含まれています。このConfigMapは、knative-serving 名前空間にあります。

次のコマンドを実行することで、現在のconfig-deployment ConfigMapを表示できます。

kubectl get configmap -n knative-serving config-deployment -oyaml

config-deployment ConfigMapの例

apiVersion: v1
kind: ConfigMap
metadata:
  name: config-deployment
  namespace: knative-serving
  labels:
    serving.knative.dev/release: devel
  annotations:
    knative.dev/example-checksum: "fa67b403"
data:
  # This is the Go import path for the binary that is containerized
  # and substituted here.
  queue-sidecar-image: ko://knative.dokyumento.jp/serving/cmd/queue
  # List of repositories for which tag to digest resolving should be skipped
  registries-skipping-tag-resolving: "kind.local,ko.local,dev.local"
  # digest-resolution-timeout is the maximum time allowed for an image's
  # digests to be resolved.
  digest-resolution-timeout: "10s"
  # progress-deadline is the duration we wait for the deployment to
  # be ready before considering it failed.
  progress-deadline: "600s"
  # queue-sidecar-cpu-request is the requests.cpu to set for the queue proxy sidecar container.
  # If omitted, a default value (currently "25m"), is used.
  queue-sidecar-cpu-request: "25m"
  # queue-sidecar-cpu-limit is the limits.cpu to set for the queue proxy sidecar container.
  # If omitted, no value is specified and the system default is used.
  queue-sidecar-cpu-limit: "1000m"
  # queue-sidecar-memory-request is the requests.memory to set for the queue proxy container.
  # If omitted, no value is specified and the system default is used.
  queue-sidecar-memory-request: "400Mi"
  # queue-sidecar-memory-limit is the limits.memory to set for the queue proxy container.
  # If omitted, no value is specified and the system default is used.
  queue-sidecar-memory-limit: "800Mi"
  # queue-sidecar-ephemeral-storage-request is the requests.ephemeral-storage to
  # set for the queue proxy sidecar container.
  # If omitted, no value is specified and the system default is used.
  queue-sidecar-ephemeral-storage-request: "512Mi"
  # queue-sidecar-ephemeral-storage-limit is the limits.ephemeral-storage to set
  # for the queue proxy sidecar container.
  # If omitted, no value is specified and the system default is used.
  queue-sidecar-ephemeral-storage-limit: "1024Mi"

進行期限の設定

進行期限の設定では、Deploymentの進行を待つ最大時間(秒または分)を指定できます。この時間を超えると、システムはKnative Revisionの進行が失敗したことを報告します。

デフォルトの進行期限は600秒です。この値はGolangのtime.Duration文字列表現として表され、秒単位の精度に丸める必要があります。

この設定で定義された制限時間内に初期スケールを達成できない場合、Knative Autoscalerコンポーネントはリビジョンを0にスケールし、Knativeサービスは端末のFailed状態になります。

Knativeデプロイメントで次のいずれかの問題が発生した場合、この設定の値を大きくすることを検討してください。

  • イメージサイズが原因で、サービスイメージのプルに時間がかかる。
  • 初期キャッシュ状態のプライミングにより、サービスがREADYになるまでに時間がかかる。
  • クラスタは、新しいPodにリソースを割り当てるために、クラスタの自動スケーリングに依存している。

詳細については、Kubernetesドキュメントを参照してください。

進行期限の設定は、ConfigMapを介してグローバルレベルで、またはアノテーションを使用してリビジョンごとに設定できます。

  • **グローバルキー:** progress-deadline
  • **リビジョンごとのアノテーションキー:** serving.knative.dev/progress-deadline
  • **可能な値:** time.Duration
  • **デフォルト:** "600s"

apiVersion: v1
kind: ConfigMap
metadata:
  name: config-deployment
  namespace: knative-serving
  labels:
    serving.knative.dev/release: devel
  annotations:
    knative.dev/example-checksum: "fa67b403"
data:
  progress-deadline: "10m"
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: helloworld-go
spec:
  template:
    metadata:
      annotations:
        serving.knative.dev/progress-deadline: "60s" 
    spec:
      containers:
        - image: ghcr.io/knative/helloworld-go:latest

タグ解決のスキップ

registries-skipping-tag-resolving ConfigMap設定を変更することで、Deploymentのタグ解決をスキップするようにKnative Servingを設定できます。

次の例は、registry.example.com のタグ解決を無効にする方法を示しています。

apiVersion: v1
kind: ConfigMap
metadata:
  name: config-deployment
  namespace: knative-serving
  labels:
    serving.knative.dev/release: devel
  annotations:
    knative.dev/example-checksum: "fa67b403"
data:
  # List of repositories for which tag to digest resolving should be skipped
  registries-skipping-tag-resolving: registry.example.com

選択可能なRuntimeClassNameの設定

runtime-class-name 設定を変更することで、指定されたRuntimeClassName(Pod.Spec.RuntimeClassName)でデプロイメントを設定するようにKnative Servingを設定できます。

この設定はサービスラベルと連携し、デフォルトまたは最も多くのラベルが一致するラベルのいずれかを設定します。

apiVersion: v1
kind: ConfigMap
metadata:
  name: config-deployment
  namespace: knative-serving
data:
  runtime-class-name: |
    kata: {}
    gvisor:
      selector:
        my-label: selector
apiVersion: operator.knative.dev/v1beta1
kind: KnativeServing
metadata:
  name: knative-serving
  namespace: knative-serving
spec:
  config:
    deployment:
      runtime-class-name: |
        kata: {}
        gvisor:
          selector:
            my-label: selector

詳細については、Kubernetes RuntimeClassドキュメントを参照してください。

別に、RuntimeClassNameの手動設定を許可する機能フラグがあります。

サイトのトラフィックを理解するために、分析とCookieを使用しています。お客様のサイトのご利用に関する情報は、その目的のためにGoogleと共有されます。詳細はこちら