Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes: Error from server (NotFound): deployments.apps "kube-verify" not found

I set up a Kubernetes cluster in my private network and managed to deploy a test pods:

now I want to expose an external ip for the service:

but when I run:

kubectl get deployments kube-verify

i get:

Error from server (NotFound): deployments.apps "kube-verify" not found

EDIT Ok I try a new approach: i have made a namespace called: verify-cluster

My deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: verify-cluster
  namespace: verify-cluster
  labels:
    app: verify-cluster
spec:
  replicas: 1
  selector:
    matchLabels:
      app: verify-cluster
  template:
    metadata:
      labels:
        app: verify-cluster
    spec:
      containers:
      - name: nginx
        image: nginx:1.18.0
        ports:
        - containerPort: 80

and service.yaml:

apiVersion: v1
kind: Service
metadata:
  name: verify-cluster
  namespace: verify-cluster
spec:
  type: NodePort
  selector:
    app: verify-cluster
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
      nodePort: 30007

then I run:

kubectl create -f deployment.yaml
kubectl create -f service.yaml

than checking

kubectl get all -n verify-cluster

but than I want to check deployment with:

kubectl get all -n verify-cluster

and get:

Error from server (NotFound): deployments.apps "verify-cluster" not found

hope that's better for reproduction ?

EDIT 2 when I deploy it to default namespace it runs directly so the issue must be something in the namespace

like image 285
Penryn Avatar asked Sep 06 '25 03:09

Penryn


1 Answers

I guess that you might have forgotten to create the namespace:

File my-namespace.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: <insert-namespace-name-here>

Then:

kubectl create -f ./my-namespace.yaml
like image 101
Cassio Avatar answered Sep 09 '25 16:09

Cassio