Kubernetes ud615 newbie secure-monolith.yaml `error validating data`?

10/6/2017

I'm a Kubernetes newbie trying to follow along with the Udacity tutorial class linked on the Kubernetes website.

I execute

kubectl create -f pods/secure-monolith.yaml

That is referencing this official yaml file: https://github.com/udacity/ud615/blob/master/kubernetes/pods/secure-monolith.yaml

I get this error:

error: error validating "pods/secure-monolith.yaml": error validating data: unknown object type schema.GroupVersionKind{Group:"", Version:"v1", Kind:"Pod"}; if you choose to ignore these errors, turn validation off with --validate=false

FYI, the official lesson link is here: https://classroom.udacity.com/courses/ud615/lessons/7824962412/concepts/81991020770923

My first guess is that the provided yaml is out of date and incompatible with the current Kubernetes. Is this right? How can I fix/update?

-- clay
kubectl
kubernetes

2 Answers

10/25/2017

After correct kubectl version (Same with server version), then the issue is fixed, see:

$ kubectl create -f config.yml
configmap "test-cfg" created

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"7", ...
Server Version: version.Info{Major:"1", Minor:"7", ...

This is the case before modification:

$ kubectl create -f config.yml
error: error validating "config.yml": error validating data: unknown object type schema.GroupVersionKind{Group:"", Version:"v1", Kind:"ConfigMap"}; if you choose to ignore these errors, turn validation off with --validate=false

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8",...
Server Version: version.Info{Major:"1", Minor:"7",...

In general, we should used same version for kubectl and kubernetes.

-- Nian Jiang
Source: StackOverflow

10/7/2017

I ran into the exact same problem but with a much simpler example.

Here's my yaml:

apiVersion: v1 kind: Pod metadata: name: nginx spec: containers: - image: nginx ports: - containerPort: 80

The command kubectl create -f pod-nginx.yaml returns:

error: error validating "pod-nginx.yaml": error validating data: unknown object type schema.GroupVersionKind{Group:"", Version:"v1", Kind:"Pod"}; if you choose to ignore these errors, turn validation off with --validate=false

As the error says, I am able to override it but I am still at a loss as to the cause of the original issue.

Local versions:

  • Ubuntu 16.04

  • minikube version: v0.22.2

  • kubectl version: 1.8

Thanks in advance!

-- jmvbxx
Source: StackOverflow