<p>I am using the kubernetes operator to create a custom resource in the cluster, the CR has the <code>Status</code> field populated, but when the object gets created the <code>Status</code> field is empty.</p>
<p>This is how I am creating the CR:</p>
<pre><code>reconcile.Create(ctx, &amp;object)
</code></pre>
<p>This is what I am trying to accomplish with k8s operator:</p>
<p><a href="https://i.stack.imgur.com/IiurP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IiurP.png" alt="enter image description here" /></a></p>

Vishrant
<p>The architecture of Kubernetes API and resources follows a pattern.</p>
<ol>
<li><p>Clients may create resources, by specifying a <em>desired state</em> (This is the <code>spec:</code> part of a resource). This is a &quot;create&quot; request sent to the API Server.</p>
</li>
<li><p>Controllers, subscribe/watch to changes of resources, while doing actions in a <em>reconciliation loop</em>, they might update the Status of the resource (this is the <code>status:</code> part of the resource).</p>
</li>
</ol>
<p>For an example of how a controller is implemented and updates the status, see the <a href="https://book.kubebuilder.io/cronjob-tutorial/controller-implementation.html#2-list-all-active-jobs-and-update-the-status" rel="nofollow noreferrer">Kubebuilder book: Implementing a Controller - Update the Status</a>.</p>
<p>The client in the example is a &quot;controller runtime client&quot;:</p>
<pre><code>&quot;sigs.k8s.io/controller-runtime/pkg/client&quot;
</code></pre>
<p>Example code, where the <em>reconciler</em> updates the <code>status</code> sub-resource:</p>
<pre><code>if err := r.Status().Update(ctx, &amp;cronJob); err != nil {
    log.Error(err, &quot;unable to update CronJob status&quot;)
    return ctrl.Result{}, err
}
</code></pre>
