アプリケーションの正常性を実行するために、kubernetesデプロイメントyamlファイルでlivenessProbeを渡そうとしています。だから、トークン値でシークレットを作成し、以下のように渡します
livenessProbe:
httpGet:
path: test/actuator/health
port: 9001
httpHeaders:
- name: Authorization
valueFrom:
secretKeyRef:
name: actuator-token
value: token
しかし、私は以下のエラーが発生しています
error: error validating "deployment.yaml": error validating data: [ValidationError(Deployment.spec.template.spec.containers[0].livenessProbe.httpGet.httpHeaders[0]): unknown field "valueFrom" in io.k8s.api.core.v1.HTTPHeader, ValidationError(Deployment.spec.template.spec.containers[0].livenessProbe.httpGet.httpHeaders[0]): missing required field "value" in io.k8s.api.core.v1.HTTPHeader, ValidationError(Deployment.spec.template.spec.containers[0].readinessProbe.httpGet.httpHeaders): invalid type for io.k8s.api.core.v1.HTTPGetAction.httpHeaders: got "map", expected "array"]; if you choose to ignore these errors, turn validation off with --validate=false
親切に提案し、助けに感謝します。
また、デプロイyamlファイルにトークン値を直接提供したくないので、トークンを処理するためのより良い方法があることもお知らせください。
httpHeaders
サポートのみでvalue
、name
フィールドは処理しませんvalueFrom
$ kubectl explain pod.spec.containers.livenessProbe.httpGet.httpHeaders
KIND: Pod
VERSION: v1
RESOURCE: httpHeaders <[]Object>
DESCRIPTION:
Custom headers to set in the request. HTTP allows repeated headers.
HTTPHeader describes a custom header to be used in HTTP probes
FIELDS:
name <string> -required-
The header field name
value <string> -required-
The header field value
のような環境変数を使用してみてください。
spec:
containers:
- name: mycontainer
image: myimage
env:
- name: MY_SECRET
valueFrom:
secretKeyRef:
name: actuator-token
key: token
livenessProbe:
httpGet:
path: test/actuator/health
port: 9001
httpHeaders:
- name: Authorization
value: $SECRET
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加