<p>I'm new to Kubernetes and I wanted to know if there is there a way I can add '--record=true' inside the deployment yaml file, so I do not have to type it on the command line!</p>

<p>I know it goes like this: kubectl apply -f deployfile.yml --record</p>

<p>I am asking this because we work on a team, and not everyone is using --record=true at the end of the command when deploying files to kubernetes!</p>

<p>Thank you in advance,</p>

Big Mojo
<p>As far as I'm aware there is no feature like <code>--record=true</code> flag in <code>kubectl</code> that you can add to <code>Manifest</code>.</p>

<p>The command which was used to start the <code>Deployment</code> is being stored in the <code>kubernetes.io/change-cause</code> annotation. This is being used for Rollout history which is described <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#checking-rollout-history-of-a-deployment" rel="nofollow noreferrer">here</a>.</p>

<blockquote>
  <p>First, check the revisions of this Deployment:</p>
  
  <p><code>kubectl rollout history deployment.v1.apps/nginx-deployment</code>
  The output is similar to this:</p>
</blockquote>

<pre><code>deployments "nginx-deployment"
REVISION    CHANGE-CAUSE
1           kubectl apply --filename=https://k8s.io/examples/controllers/nginx-deployment.yaml --record=true
2           kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.9.1 --record=true
3           kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.91 --record=true
</code></pre>

<blockquote>
  <p><code>CHANGE-CAUSE</code> is copied from the Deployment annotation <code>kubernetes.io/change-cause</code> to its revisions upon creation. You can specify the <code>CHANGE-CAUSE</code> message by:</p>
  
  <ul>
  <li>Annotating the Deployment with <code>kubectl annotate deployment.v1.apps/nginx-deployment kubernetes.io/change-cause="image updated to 1.9.1"</code></li>
  <li>Append the <code>--record</code> flag to save the <code>kubectl</code> command that is making changes to the resource.</li>
  <li>Manually editing the manifest of the resource.</li>
  </ul>
  
  <p>To see the details of each revision, run:
  <code>kubectl rollout history deployment.v1.apps/nginx-deployment --revision=2</code></p>
  
  <p>The output is similar to this:</p>
</blockquote>

<pre><code>deployments "nginx-deployment" revision 2
  Labels:       app=nginx
          pod-template-hash=1159050644
  Annotations:  kubernetes.io/change-cause=kubectl set image deployment.v1.apps/nginx-deployment nginx=nginx:1.9.1 --record=true
  Containers:
   nginx:
    Image:      nginx:1.9.1
    Port:       80/TCP
     QoS Tier:
        cpu:      BestEffort
        memory:   BestEffort
    Environment Variables:      &lt;none&gt;
  No volumes.
</code></pre>

<p>For the command history I would use <code>$ history</code> or check user bash_history </p>

<p><code>$ tail /home/username/.bash_history</code></p>
