kubernetes: kubectl 1.8 cannot validate simple namespace yml

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

What happened: kubectl 1.8.0 fails to validate a simple namespace yml:

apiVersion: v1
kind: Namespace
metadata:
  name: foo

Same problem if I use json (which is how I first noticed, it trying to restore from a get ns -ojson --export )

What you expected to happen: kubectl to validate and pass it on to the cluster

How to reproduce it (as minimally and precisely as possible):

  1. Create foo.yml with the content above
  2. kubectl apply -f foo.yml (or create if you prefer) with kubectl 1.8.0 - it fails validation
  3. kubectl apply -f foo.yml with kubectl 1.7.5 - it works

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version):
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-07-26T00:12:31Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

For the working 1.7.5:

Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.5", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-08-31T09:14:02Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.0", GitCommit:"d3ada0119e776222f11ec7945e6d860061339aad", GitTreeState:"clean", BuildDate:"2017-07-26T00:12:31Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration**:

Running on minikube to replicate

  • OS (e.g. from /etc/os-release):

From minikube:

$ cat /etc/os-release
NAME=Buildroot
VERSION=2017.02
ID=buildroot
VERSION_ID=2017.02
PRETTY_NAME="Buildroot 2017.02"
  • Kernel (e.g. uname -a):
$ uname -a
Linux minikube 4.9.13 #1 SMP Tue Jul 18 22:17:02 UTC 2017 x86_64 GNU/Linux
  • Install tools:

minikube

  • Others:

Summary:

/tmp # cat foo.yml
apiVersion: v1
kind: Namespace
metadata:
  name: foo
/tmp # kubectl175 apply -f foo.yml
namespace "foo" configured
/tmp # kubectl180 apply -f foo.yml
error: error validating "foo.yml": error validating data: unknown object type schema.GroupVersionKind{Group:"", Version:"v1", Kind:"Namespace"}; if you choose to ignore these errors, turn validation off with --validate=false

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 14
  • Comments: 23 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Downgrading kubectl to v1.7.8 worked for me.

curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.7.8/bin/darwin/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl

Check your version afterwards:

kubectl version

Same problem here. Versions are same as with @lordoffreaks

FYI, did look for an open similar bug, no luck.

Same problem here, it’s happening for all the entities … validation fails for services and deployments at leasts

kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", BuildDate:"2017-09-29T05:56:06Z", GoVersion:"go1.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.5", GitCommit:"17d7182a7ccbb167074be7a87f0a68bd00d58d97", GitTreeState:"clean", BuildDate:"2017-09-18T20:30:29Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
$ cat /etc/os-release
NAME=Buildroot
VERSION=2016.08
ID=buildroot
VERSION_ID=2016.08
PRETTY_NAME="Buildroot 2016.08"

And all working fine in latest minikube version as well:

$ minikube version
minikube version: v0.22.3

Basically yml/json validation in kubectl 1.8.0 is broken completely. A test or two missed, I guess.

Someone from the @kubernetes/sig-cli-bugs team can address?

now use kubectl create/replace/apply --validate=false to work around

I think it is asking for trouble. I don’t mind using it in minikube, but no way I am doing that with a more-important cluster.

In any case, this really shouldn’t fail.

I downloaded kubectl version v1.7.7 even that helps!