<p>I am trying to pass livenessProbe in my kubernetes deployment yaml file to perform the health of my application. so, I created a secret with token value and passing as below</p>

<pre><code>      livenessProbe:
        httpGet:
          path: test/actuator/health
          port: 9001
          httpHeaders:
          - name: Authorization
            valueFrom:
              secretKeyRef:
                name: actuator-token
                value: token
</code></pre>

<p>but I am getting the below error</p>

<p><code>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</code></p>

<p>Kindly suggest and appreciate for the help.</p>

<p>Also let us know is their any better way of handling tokens as I don't want to provide token value directly on my deployment yaml file.</p>

<p><code>httpHeaders</code> only supports <code>value</code> and <code>name</code> field does not handle <code>valueFrom</code></p>

<pre><code>$ kubectl explain pod.spec.containers.livenessProbe.httpGet.httpHeaders

KIND:     Pod
VERSION:  v1

RESOURCE: httpHeaders &lt;[]Object&gt;

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 &lt;string&gt; -required-
     The header field name

   value        &lt;string&gt; -required-
     The header field value
</code></pre>

<p>You could try using env variable like.</p>

<pre><code>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
</code></pre>
