I created the below ns.yaml file:
apiVersion: v1
kind: Namespace
metadata:
Name: testns
I am getting the below error.
error: error validating "ns.yaml": error validating data: ValidationError(Namespace.metadata): unknown field "Name" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta; if you choose to ignore these errors, turn validation off with --validate=false
The root cause is clear in the error logs: unknown field "Name" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta;
This means you need to use name
instead of Name
.
For more info about YAML format of Kubernetes object Namespace metadata, run the following command :
kubectl explain namespace.metadata
And you will get amazing documentation.