<p>I've created a resource with:
<code>kubectl create -f example.yaml</code></p>

<p>How do I edit this resource with kubectl?  Supposedly <code>kubectl edit</code>, but I'm not sure of the resource name, and <code>kubectl edit example</code> returns an error of:</p>

<pre><code>the server doesn't have a resource type "example"
</code></pre>

<p>You can do a <code>kubectl edit -f example.yaml</code> to edit it directly. Nevertheless I would recommend to edit the file locally and do a <code>kubectl apply -f example.yaml</code>, so it gets updated on Kubernetes.</p>

<p>Also: Your command fails, because you have to specify a resource type. Example types are <code>pod</code>, <code>service</code>, <code>deployment</code> and so on. You can see all possible types with a plain <code>kubectl get</code>. The type should match the <code>kind</code> value in the YAML file and the name should match <code>metadata.name</code>.</p>

<p>For example the following file could be edited with <code>kubectl edit deployment nginx-deployment</code></p>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2 # tells deployment to run 2 pods matching the template
  template: # create pods using pod definition in this template
    metadata:
      # unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is
      # generated from the deployment name
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80
</code></pre>
