no object named "pod" is registered

8/25/2015

What does this mean?

-bash-4.2# kubectl create -f ./pod.yaml
Error: unable to recognize "./pod.yaml": no object named "pod" is registered

pod.yaml, capitalizing or not capitalizing 'pod' makes no difference. Validates as proper YAML.

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - containerPort: 80
      hostPort: 8080
--
kubernetes

2 Answers

8/25/2015

Can you please run kubectl version and report the results? I expect that either your apisver or kubectl version is outdated, and thus doesn't know about the v1 API.

For what it's worth, that pod spec works for me with both kubectl and my apiserver at version 1.0.3.

-- Alex Robinson
Source: StackOverflow

5/13/2019

i was able to create the pod

master $ kubectl create -f pod.yaml
pod/nginx created

master $ kubectl get po
NAME      READY     STATUS    RESTARTS   AGE
nginx     1/1       Running   0          1m

cat pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx
    image: nginx
    ports:
    - containerPort: 80
      hostPort: 8080

most likely issue is with the kubernetes on your server. can you check k8s components health status. i dont see any issue with the pod manifest. it should work

-- P Ekambaram
Source: StackOverflow