<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;4&quot;, GitVersion:&quot;v1.4.3&quot;, GitCommit:&quot;4957b090e9a4f6a68b4a40375408fdc74a212260&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2016-10-16T06:36:33Z&quot;, GoVersion:&quot;go1.7.1&quot;, Compiler:&quot;gc&quot;, Platform:&quot;darwin/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;4&quot;, GitVersion:&quot;v1.4.3&quot;, GitCommit:&quot;4957b090e9a4f6a68b4a40375408fdc74a212260&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2016-10-16T06:20:04Z&quot;, GoVersion:&quot;go1.6.3&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}"><pre class="notranslate"><code class="notranslate">Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.3", GitCommit:"4957b090e9a4f6a68b4a40375408fdc74a212260", GitTreeState:"clean", BuildDate:"2016-10-16T06:36:33Z", GoVersion:"go1.7.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.3", GitCommit:"4957b090e9a4f6a68b4a40375408fdc74a212260", GitTreeState:"clean", BuildDate:"2016-10-16T06:20:04Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
</code></pre></div>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>: kops-deployed running on aws</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): debian</li>
</ul>
<p dir="auto"><strong>What happened</strong>: when I do <code class="notranslate">kubectl -f apply my-scheduled-job.yml</code> without that job being present, everything works ok, but when I apply an already existing job, I get a "no kind "ScheduledJob" is registered for version "batch/v1"".</p>
<p dir="auto">If you are not able to reproduce it, I can provide my job, but it's a pretty straightforward one, not a lot of options</p>
<p dir="auto"><strong>Is this a request for help?</strong> (If yes, you should use our troubleshooting guide and community support channels, see <a href="http://kubernetes.io/docs/troubleshooting/" rel="nofollow">http://kubernetes.io/docs/troubleshooting/</a>.):</p>
<p dir="auto">Nope!</p>
<p dir="auto"><strong>What keywords did you search in Kubernetes issues before filing this one?</strong> (If you have found any duplicates, you should instead reply there.):</p>
<p dir="auto">kubectl, apply, scheduledjob, batch/v1</p>
<hr>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one):</p>

<p dir="auto">BUG REPORT</p>
<p dir="auto"><strong>Kubernetes version</strong> (use <code class="notranslate">kubectl version</code>):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Client Version: version.Info{Major:&quot;1&quot;, Minor:&quot;4&quot;, GitVersion:&quot;v1.4.1&quot;, GitCommit:&quot;33cf7b9acbb2cb7c9c72a10d6636321fb180b159&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2016-10-10T18:19:49Z&quot;, GoVersion:&quot;go1.6.3&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}
Server Version: version.Info{Major:&quot;1&quot;, Minor:&quot;4&quot;, GitVersion:&quot;v1.4.1&quot;, GitCommit:&quot;33cf7b9acbb2cb7c9c72a10d6636321fb180b159&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2016-10-10T18:13:36Z&quot;, GoVersion:&quot;go1.6.3&quot;, Compiler:&quot;gc&quot;, Platform:&quot;linux/amd64&quot;}"><pre class="notranslate"><code class="notranslate">Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.1", GitCommit:"33cf7b9acbb2cb7c9c72a10d6636321fb180b159", GitTreeState:"clean", BuildDate:"2016-10-10T18:19:49Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.1", GitCommit:"33cf7b9acbb2cb7c9c72a10d6636321fb180b159", GitTreeState:"clean", BuildDate:"2016-10-10T18:13:36Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
</code></pre></div>
<p dir="auto"><strong>Environment</strong>:</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>: AWS</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): <code class="notranslate">Debian GNU/Linux 8 (jessie)</code></li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): <code class="notranslate">Linux ip-172-20-61-42 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux</code></li>
<li><strong>Install tools</strong>: <code class="notranslate">kops</code></li>
<li><strong>Others</strong>: n/a</li>
</ul>
<p dir="auto"><strong>What happened</strong>:</p>
<p dir="auto"><code class="notranslate">kubectl apply</code> emits an error when applying changes to an existing <code class="notranslate">ScheduledJob</code>.</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto"><code class="notranslate">kubectl apply</code> should have successfully applied changes to the existing <code class="notranslate">ScheduledJob</code>.</p>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible):</p>
<p dir="auto">Given this <code class="notranslate">ScheduledJob</code> manifest:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# scheduledjob.yaml
# From http://kubernetes.io/docs/user-guide/scheduled-jobs/#creating-a-scheduled-job
apiVersion: batch/v2alpha1
kind: ScheduledJob
metadata:
  name: hello
spec:
  schedule: 0/1 * * * ?
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: hello
            image: busybox
            args:
            - /bin/sh
            - -c
            - date; echo Hello from the Kubernetes cluster
          restartPolicy: OnFailure"><pre class="notranslate"><span class="pl-c"><span class="pl-c">#</span> scheduledjob.yaml</span>
<span class="pl-c"><span class="pl-c">#</span> From http://kubernetes.io/docs/user-guide/scheduled-jobs/#creating-a-scheduled-job</span>
<span class="pl-ent">apiVersion</span>: <span class="pl-s">batch/v2alpha1</span>
<span class="pl-ent">kind</span>: <span class="pl-s">ScheduledJob</span>
<span class="pl-ent">metadata</span>:
  <span class="pl-ent">name</span>: <span class="pl-s">hello</span>
<span class="pl-ent">spec</span>:
  <span class="pl-ent">schedule</span>: <span class="pl-s">0/1 * * * ?</span>
  <span class="pl-ent">jobTemplate</span>:
    <span class="pl-ent">spec</span>:
      <span class="pl-ent">template</span>:
        <span class="pl-ent">spec</span>:
          <span class="pl-ent">containers</span>:
          - <span class="pl-ent">name</span>: <span class="pl-s">hello</span>
            <span class="pl-ent">image</span>: <span class="pl-s">busybox</span>
            <span class="pl-ent">args</span>:
            - <span class="pl-s">/bin/sh</span>
            - <span class="pl-s">-c</span>
            - <span class="pl-s">date; echo Hello from the Kubernetes cluster</span>
          <span class="pl-ent">restartPolicy</span>: <span class="pl-s">OnFailure</span></pre></div>
<p dir="auto">The first apply succeeds:</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ kubectl apply -f scheduledjob.yaml 
scheduledjob &quot;hello&quot; created"><pre class="notranslate">$ <span class="pl-s1">kubectl apply -f scheduledjob.yaml </span>
<span class="pl-c1">scheduledjob "hello" created</span></pre></div>
<p dir="auto">The second one fails:</p>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ kubectl apply -f scheduledjob.yaml
error: error when applying patch:

to:
&amp;{0xc8200bd740 0xc8202f8ee0 sandbox hello scheduledjob.yaml &amp;ScheduledJob{ObjectMeta:k8s_io_kubernetes_pkg_api_v1.ObjectMeta{Name:hello,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:&lt;nil&gt;,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{kubectl.kubernetes.io/last-applied-configuration: ,},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:ScheduledJobSpec{Schedule:0/1 * * * ?,StartingDeadlineSeconds:nil,ConcurrencyPolicy:,Suspend:nil,JobTemplate:JobTemplateSpec{ObjectMeta:k8s_io_kubernetes_pkg_api_v1.ObjectMeta{Name:,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:&lt;nil&gt;,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:JobSpec{Parallelism:nil,Completions:nil,ActiveDeadlineSeconds:nil,Selector:nil,ManualSelector:nil,Template:k8s_io_kubernetes_pkg_api_v1.PodTemplateSpec{ObjectMeta:ObjectMeta{Name:,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:&lt;nil&gt;,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:PodSpec{Volumes:[],Containers:[{hello busybox [] [/bin/sh -c date; echo Hello from the Kubernetes cluster]  [] [] {map[] map[]} [] nil nil nil   nil false false false}],RestartPolicy:OnFailure,TerminationGracePeriodSeconds:nil,ActiveDeadlineSeconds:nil,DNSPolicy:,NodeSelector:map[string]string{},ServiceAccountName:,DeprecatedServiceAccount:,NodeName:,HostNetwork:false,HostPID:false,HostIPC:false,SecurityContext:nil,ImagePullSecrets:[],Hostname:,Subdomain:,},},},},},Status:ScheduledJobStatus{Active:[],LastScheduleTime:&lt;nil&gt;,},} &amp;TypeMeta{Kind:,APIVersion:,} 12601558 false}
for: &quot;scheduledjob.yaml&quot;: error when serializing current configuration from:
&amp;TypeMeta{Kind:,APIVersion:,}
for: &quot;scheduledjob.yaml&quot;: no kind &quot;ScheduledJob&quot; is registered for version &quot;batch/v1&quot;"><pre class="notranslate">$ <span class="pl-s1">kubectl apply -f scheduledjob.yaml</span>
<span class="pl-c1">error: error when applying patch:</span>

<span class="pl-c1">to:</span>
&amp;{0xc8200bd740 0xc8202f8ee0 sandbox hello scheduledjob.yaml &amp;ScheduledJob{ObjectMeta:k8s_io_kubernetes_pkg_api_v1.ObjectMeta{Name:hello,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:&lt;nil&gt;,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{kubectl.kubernetes.io/last-applied-configuration: ,},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:ScheduledJobSpec{Schedule:0/1 * * * ?,StartingDeadlineSeconds:nil,ConcurrencyPolicy:,Suspend:nil,JobTemplate:JobTemplateSpec{ObjectMeta:k8s_io_kubernetes_pkg_api_v1.ObjectMeta{Name:,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:&lt;nil&gt;,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:JobSpec{Parallelism:nil,Completions:nil,ActiveDeadlineSeconds:nil,Selector:nil,ManualSelector:nil,Template:k8s_io_kubernetes_pkg_api_v1.PodTemplateSpec{ObjectMeta:ObjectMeta{Name:,GenerateName:,Namespace:,SelfLink:,UID:,ResourceVersion:,Generation:0,CreationTimestamp:0001-01-01 00:00:00 +0000 UTC,DeletionTimestamp:&lt;nil&gt;,DeletionGracePeriodSeconds:nil,Labels:map[string]string{},Annotations:map[string]string{},OwnerReferences:[],Finalizers:[],ClusterName:,},Spec:PodSpec{Volumes:[],Containers:[{hello busybox [] [/bin/sh -c date; echo Hello from the Kubernetes cluster]  [] [] {map[] map[]} [] nil nil nil   nil false false false}],RestartPolicy:OnFailure,TerminationGracePeriodSeconds:nil,ActiveDeadlineSeconds:nil,DNSPolicy:,NodeSelector:map[string]string{},ServiceAccountName:,DeprecatedServiceAccount:,NodeName:,HostNetwork:false,HostPID:false,HostIPC:false,SecurityContext:nil,ImagePullSecrets:[],Hostname:,Subdomain:,},},},},},Status:ScheduledJobStatus{Active:[],LastScheduleTime:&lt;nil&gt;,},} &amp;TypeMeta{Kind:,APIVersion:,} 12601558 false}
<span class="pl-c1">for: "scheduledjob.yaml": error when serializing current configuration from:</span>
<span class="pl-c1">&amp;TypeMeta{Kind:,APIVersion:,}</span>
<span class="pl-c1">for: "scheduledjob.yaml": no kind "ScheduledJob" is registered for version "batch/v1"</span></pre></div>
<p dir="auto"><strong>Anything else do we need to know</strong>:</p>
<ul dir="auto">
<li><code class="notranslate">ScheduledJob</code> is enabled on the apiserver via <code class="notranslate">--runtime-config=batch/v2alpha1=true</code></li>
<li>first reported downstream at <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="183827268" data-permission-text="Title is private" data-url="https://github.com/helm/helm/issues/1408" data-hovercard-type="issue" data-hovercard-url="/helm/helm/issues/1408/hovercard" href="https://github.com/helm/helm/issues/1408">helm/helm#1408</a></li>
</ul>