I'm trying to use the kubectl pipe to deploy to kubernets but I'm getting the error:
<span> File "/pipe.py", line 165, in <module></span><span> <a href="http://pipe.run" target="_blank" rel="noopener nofollow noreferrer">pipe.run</a>()</span><span> File "/pipe.py", line 156, in run</span><span> self.handle_apply()</span><span> File "/pipe.py", line 113, in handle_apply</span><span> self.update_labels_in_metadata(template_file, labels)</span><span> File "/pipe.py", line 36, in update_labels_in_metadata</span><span> yaml_doc['metadata'].setdefault('labels', {}).update(labels)</span><span>KeyError: 'metadata'</span><span>Traceback (most recent call last):</span>
I assume that this is because my yml doesn't have a root element "metadata". The yml was generated using the fabric8 maven plugin, and looks similar to the below (I've removed large chunks of it, but this should be enough to go on:
---
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Service
metadata:
annotations:
labels:
name:
spec:
ports:
type: NodePort
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
labels:
name:
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
template:
metadata:
annotations:
labels:
spec:
containers: