<p>I have this following yaml file:</p>
<p>#deployment.yaml</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2 
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
      - containerPort: 80
</code></pre>
<p>That I'm trying to apply with this command:</p>
<p><code>kubectl apply -f deployment.yaml</code></p>
<p>I have checked if could be something with indentation, replaced tabs for spaces but I keep getting this error</p>
<p><code>error: proto: cannot parse invalid wire-format data</code></p>
<p>I also have the same error when applying from template</p>
<p><code>kubectl apply -f https://k8s.io/examples/application/deployment.yaml</code></p>

Pedro Neri
<p>In your snippet, there some indentation issues in <code>.spec.template.spec.containers</code> section. Your indentations should be like this:</p>
<pre><code>  containers:
    - name: nginx
      image: nginx:1.14.2
      ports:
        - containerPort: 80
</code></pre>
