Set Kyar Wa Lar
Set Kyar Wa Lar

Reputation: 4644

Kubectl create "invalid object"

I am creating namespace using kubectl with yaml. The following is my yaml configuration

apiVersion: v1
kind: Namespace
metadata:
    name: "slackishapp"
    labels:
        name: "slackishapp"

But, when I run kubectl create -f ./slackish-namespace-manifest.yaml, I got an error like the following

error: SchemaError(io.k8s.api.autoscaling.v2beta2.PodsMetricStatus): invalid object doesn't have additional properties.

What goes wrong on my yaml? I am reading about it on the documentation as well. I don't see any difference with my configuration.

Upvotes: 7

Views: 8237

Answers (3)

ibs4lif
ibs4lif

Reputation: 31

Download the kubectl.exe on https://kubernetes.io/docs/tasks/tools/install-kubectl/#before-you-begin then replace it on Program Files\Docker\Docker\resources\bin if you have docker desktop

Like Andreas Wederbrand said, it is a version problem.

Upvotes: 3

Andreas Wederbrand
Andreas Wederbrand

Reputation: 40061

There is nothing wrong with your yaml but I suspect you have the wrong version of kubectl.

kubectl needs to be within 1 minor from the cluster you are using as described here.

You can check your versions with

kubectl version

Upvotes: 12

A_Suh
A_Suh

Reputation: 3956

As a workaround, try to create your namespace within imperative mode

kubectl create ns slackishapp && kubectl label ns slackishapp name=slackishapp

And then compare existing yaml with one you have written in order to check what is missing

kubectl get ns slackishapp -o yaml --export

Upvotes: 2

Related Questions