Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 473
Set Kyar Wa Lar Avatar asked Apr 05 '19 05:04

Set Kyar Wa Lar


People also ask

Why does the kubectl--resource-version command fail?

If --resource-version is specified and does not match the current resource version on the server the command will fail. Use "kubectl api-resources" for a complete list of supported resources. $ kubectl annotate [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]

How to configure kubectl in Kubernetes?

Path to the kubectl configuration ("kubeconfig") file. Default: "$HOME/.kube/config" When set to false, turns off extra HTTP headers detailing invoked kubectl command (Kubernetes version v1.22 or later) kubectl certificate - Modify certificate resources. kubectl cp - Copy files and directories to and from containers.

Why am I getting a validation error with kubectl applya?

Attempting to kubectl applya manifest whose resources have been previously modified using kubectl edit(see steps to reproduce below) raises a validation error.

How to ignore errors when a key is missing in kubectl?

$ kubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.


Video Answer


1 Answers

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
like image 153
Andreas Wederbrand Avatar answered Oct 02 '22 00:10

Andreas Wederbrand