<p>Say I have this VPA config file:</p>
<pre><code>apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: vpa-reco
spec:
  targetRef:
    apiVersion: &quot;batch/v1beta1&quot;
    kind: CronJob
    name: test-autoscaling-1
  updatePolicy:
    updateMode: &quot;Off&quot;
</code></pre>
<p>How can I make my VPA target CronJob <code>test-autoscaling-2</code> also?</p>

<p>Unfortunately you can't reference multiple objects in a single <code>VPA</code> object.</p>
<p>If you tried like below (to have 2 <code>CronJobs</code> in a single <code>VPA</code>):</p>
<pre><code>apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: vpa-reco
spec:
  targetRef:
  - apiVersion: &quot;batch/v1beta1&quot;
    kind: CronJob
    name: test-autoscaling-1
  - apiVersion: &quot;batch/v1beta1&quot;
    kind: CronJob
    name: test-autoscaling-2
  updatePolicy:
    updateMode: &quot;Off&quot;
</code></pre>
<p>You should got the error (part of it) similar to the one below:</p>
<pre class="lang-sh prettyprint-override"><code>denied the request: json: cannot unmarshal array into Go struct field VerticalPodAutoscalerSpec.targetRef of type v1.CrossVersionObjectReference
</code></pre>
<p>To have the <code>VPA</code> configured for: <code>test-autoscaling-1</code> and <code>test-autoscaling-2</code> <strong>you would need to create 2 separate <code>VPA</code> objects</strong> like: <code>vpa-reco-1</code> and <code>vpa-reco-2</code>.</p>
<hr />
<p>Talking from the perspective of a <code>VPA</code> with <code>CronJob</code>, support for it was added in the version <code>0.7.0</code>. More can be found in this specific release note:</p>
<ul>
<li><em><a href="https://github.com/kubernetes/autoscaler/releases/tag/vertical-pod-autoscaler-0.7.0" rel="nofollow noreferrer">Github.com: Kubernetes: Autoscaler: Releases: Tag: Vertical pod autoscaler 0.7.0</a></em></li>
</ul>
<p>Additional resources:</p>
<ul>
<li><em><a href="https://github.com/kubernetes/autoscaler" rel="nofollow noreferrer">Github.com: Kubernetes: Autoscaler</a></em></li>
</ul>
