<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>.): No</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.): <code class="notranslate">kubectl apply</code>, <code class="notranslate">kubectl apply label:kind/bug</code> and <code class="notranslate">apply error label:kind/bug</code></p>
<hr>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one): 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.5&quot;, GitCommit:&quot;5a0a696437ad35c133c0c8493f7e9d22b0f9b81b&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2016-10-29T01:38:40Z&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.5&quot;, GitCommit:&quot;5a0a696437ad35c133c0c8493f7e9d22b0f9b81b&quot;, GitTreeState:&quot;clean&quot;, BuildDate:&quot;2016-10-29T01:32:42Z&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.5", GitCommit:"5a0a696437ad35c133c0c8493f7e9d22b0f9b81b", GitTreeState:"clean", BuildDate:"2016-10-29T01:38:40Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.5", GitCommit:"5a0a696437ad35c133c0c8493f7e9d22b0f9b81b", GitTreeState:"clean", BuildDate:"2016-10-29T01:32:42Z", 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>: Docker container</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): Debian GNU/Linux 8 (jessie)</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): Linux 37638c28ef33 4.8.4-1-ARCH <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="35192559" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/1" data-hovercard-type="issue" data-hovercard-url="/kubernetes/kubernetes/issues/1/hovercard" href="https://github.com/kubernetes/kubernetes/issues/1">#1</a> SMP PREEMPT Sat Oct 22 18:26:57 CEST 2016 x86_64 GNU/Linux (apparently uname -a shows the host system on containers?)</li>
<li><strong>Install tools</strong>: gcloud</li>
<li><strong>Others</strong>: Docker container running the deployment script on our CI (Codeship)</li>
</ul>
<p dir="auto"><strong>What happened</strong>: Our deploy script reads our yaml files and feeds them to <code class="notranslate">kubectl apply -f</code>. Today we didn't have a regular error like "this property can't be updated", it gave us a server error apparently applying a bad patch to the kubernetes resource.<br>
Here is the stderr output: <a href="https://gist.github.com/Draiken/e189868555a53d7c0c5254c7eb04a4f8">https://gist.github.com/Draiken/e189868555a53d7c0c5254c7eb04a4f8</a></p>
<p dir="auto"><strong>What you expected to happen</strong>: kubectl apply either refuse to send the patch if we're doing some impossible update or successfully update the deployment.</p>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible): Unfortunately, I wasn't able to reproduce it. After the error I took the same yaml file used when the error happened and kubectl apply worked without errors.<br>
Here is the resource on kubernetes: <a href="https://gist.github.com/55145dc42d1e06ee625306247040fba3">https://gist.github.com/55145dc42d1e06ee625306247040fba3</a><br>
Here is the resource we applied: <a href="https://gist.github.com/25932503e3b6d0dc8a810f8fb3682411">https://gist.github.com/25932503e3b6d0dc8a810f8fb3682411</a></p>
<p dir="auto">I have a cluster with ~130 pods.  Running back-to-back 'get pods' shows me wildly different understandings of their state, even though I can tell from docker that they have not crashed or anything.</p>
<p dir="auto">thockin@freakshow kubernetes master /$ ./cluster/kubectl.sh get pods -l app=hostnames | awk '{print $(NF)}' | sort | uniq -c<br>
Running: ./cluster/../cluster/gce/../../_output/dockerized/bin/linux/amd64/kubectl get pods -l app=hostnames<br>
127 Running<br>
1 STATUS<br>
6 Unknown</p>
<p dir="auto">thockin@freakshow kubernetes master /$ ./cluster/kubectl.sh get pods -l app=hostnames | awk '{print $(NF)}' | sort | uniq -c<br>
Running: ./cluster/../cluster/gce/../../_output/dockerized/bin/linux/amd64/kubectl get pods -l app=hostnames<br>
82 Running<br>
1 STATUS<br>
51 Unknown</p>
<p dir="auto">Nothing changed in between these calls.</p>