<p>Kubectl command alway returns this error yaml: line 2: mapping values are not allowed in this context. Even when i call normal version command, config command, etc. Not sure whats causing this.</p>

<pre><code>tessact@tessact-sys-1:~$ kubectl version
Client Version: version.Info{Major:"1", Minor:"4",
GitVersion:"v1.4.4",
GitCommit:"3b417cc4ccd1b8f38ff9ec96bb50a81ca0ea9d56",
GitTreeState:"clean", BuildDate:"2016-10-21T02:48:38Z",
GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
error: yaml: line 2: mapping values are not allowed in this context


tessact@tessact-sys-1:~/[some path]$ kubectl create -f kubernetes_configs/frontend.yaml
error: yaml: line 2: mapping values are not allowed in this context
</code></pre>

<p>The only yaml file i used is </p>

<pre><code>apiVersion: v1
kind: ReplicationController
metadata:
  name: frontend
  labels:
    name: frontend
spec:
  replicas: 3
  template:
    metadata:
      labels:
        name: frontend
    spec:
      containers:
      - name: trigger
        # Replace  with your project ID or use `make template`
        image: asia.gcr.io/trigger-backend/trigger-backend

        # This setting makes nodes pull the docker image every time before
        # starting the pod. This is useful when debugging, but should be turned
        # off in production.
        imagePullPolicy: Always
        ports:
        - containerPort: 8080


apiVersion: v1
kind: Service
metadata:
  name: frontend
  labels:
    name: frontend
spec:
  type: LoadBalancer
  ports:
  - port: 80
    targetPort: 8080
  selector:
    name: frontend
</code></pre>

<p>Whatever I try with <strong>kubectl</strong> it returns this error. What should I do to solve this?</p>

<pre><code>&gt; tessact@tessact-sys-1:~/developer/trigger-backend-dev/trigger-backend$
&gt; kubectl get service error: yaml: line 2: mapping values are not
&gt; allowed in this context
</code></pre>

<p>Output of :</p>

<pre><code>strace kubectl version
</code></pre>

<p>is <a href="http://pastebin.com/E53yHrwD" rel="noreferrer">here</a></p>

<p>That the version command already throws an error indicates that there is some default YAML file that gets loaded.</p>

<p>You can use <code>strace kubectl version</code> to see what file was opened, hopefully this is done just before <code>kubectl</code> throws the error. I assume there is some global config that it reads (or alternatively a default file in your current directory).</p>

<p>It is of course sloppy programming in kubernetes not to catch such an error, and display the name of the file, and then re-raise the error.</p>
