I've created a resource with:
kubectl create -f example.yaml
How do I edit this resource with kubectl? Supposedly kubectl edit
, but I'm not sure of the resource name, and kubectl edit example
returns an error of:
the server doesn't have a resource type "example"
You can do a
kubectl edit -f example.yaml
to edit it directly. Nevertheless I would recommend to edit the file locally and do akubectl apply -f example.yaml
, so it gets updated on Kubernetes.Also: Your command fails, because you have to specify a resource type. Example types are
pod
,service
,deployment
and so on. You can see all possible types with a plainkubectl get
. The type should match thekind
value in the YAML file and the name should matchmetadata.name
.For example the following file could be edited with
kubectl edit deployment nginx-deployment