Pods remain pending

Getting pending for my launched pods:

kubectl get pods --all-namespaces
NAMESPACE              NAME                                         READY   STATUS    RESTARTS   AGE
kube-system            coredns-66bff467f8-hmgfm                     1/1     Running   4          176d
kube-system            coredns-66bff467f8-wlph7                     1/1     Running   4          176d
kube-system            etcd-minikube                                1/1     Running   0          91m
kube-system            kube-apiserver-minikube                      1/1     Running   0          91m
kube-system            kube-controller-manager-minikube             1/1     Running   6          176d
kube-system            kube-proxy-6ghsb                             1/1     Running   4          176d
kube-system            kube-scheduler-minikube                      1/1     Running   6          176d
kube-system            storage-provisioner                          1/1     Running   8          176d
kubernetes-dashboard   dashboard-metrics-scraper-84bfdf55ff-sw5n7   1/1     Running   4          176d
kubernetes-dashboard   kubernetes-dashboard-696dbcc666-mg5m9        1/1     Running   7          176d
smt-prod               web-d8b69f76f-d5qj6                          0/4     Pending   0          3m28s
smt-prod               web-d8b69f76f-t792t                          0/4     Pending   0          3m28s

Seems pods cannot be found…

kubectl describe pod web-d8b69f76f-d5qj6
Error from server (NotFound): pods "web-d8b69f76f-d5qj6" not found

and deployment not available

ubectl get deployments --all-namespaces
NAMESPACE              NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
kube-system            coredns                     2/2     2            2           176d
kubernetes-dashboard   dashboard-metrics-scraper   1/1     1            1           176d
kubernetes-dashboard   kubernetes-dashboard        1/1     1            1           176d
smt-prod               web                         0/2     2            0           12m

the deployment used is

using Docker Images from Docker Hub I set up there myself.

When I check events I do not see anything helpful as of yet

kubectl get events               
LAST SEEN   TYPE      REASON           OBJECT                        MESSAGE
34m         Normal    RegisteredNode   node/minikube                 Node minikube event: Registered Node minikube in Controller
37m         Warning   FailedGetScale   horizontalpodautoscaler/web   deployments/scale.apps "web" not found
4m19s       Warning   FailedGetScale   horizontalpodautoscaler/web   deployments/scale.apps "web" not found

Why do these new deployments remain pending? How to remedy this?

Seems to loads the pod’s description I had to add the namespace as well. Here it is now

smt-deploy git:(main) ✗ kubectl describe pod web-d8b69f76f-d5qj6 -n smt-prod      
Name:           web-d8b69f76f-d5qj6
Namespace:      smt-prod
Priority:       0
Node:           <none>
Labels:         app=web
                pod-template-hash=d8b69f76f
                tier=backend
Annotations:    <none>
Status:         Pending
IP:             
IPs:            <none>
Controlled By:  ReplicaSet/web-d8b69f76f
Init Containers:
  install:
    Image:      busybox
    Port:       9000/TCP
    Host Port:  0/TCP
    Command:
      wget
      -O
      /code/index.php
      https://raw.githubusercontent.com/do-community/php-kubernetes/master/index.php
    Limits:
      cpu:  500m
    Requests:
      cpu:        250m
    Environment:  <none>
    Mounts:
      /code from code (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-4cv6p (ro)
Containers:
  laravel:
    Image:        smart48/smt-laravel:latest
    Port:         <none>
    Host Port:    <none>
    Environment:  <none>
    Mounts:
      /code from code (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-4cv6p (ro)
  workspace:
    Image:        smart48/smt-workspace:latest
    Port:         22/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:
      /code from code (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-4cv6p (ro)
  laravel-horizon:
    Image:      smart48/smt-laravel-horizon:latest
    Port:       <none>
    Host Port:  <none>
    Command:
      /usr/local/bin/php
      artisan
      horizon
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-4cv6p (ro)
  nginx:
    Image:        smart48/smt-nginx:latest
    Port:         80/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:
      /code from code (rw)
      /etc/nginx/conf.d from config (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-4cv6p (ro)
Conditions:
  Type           Status
  PodScheduled   False 
Volumes:
  code:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  code
    ReadOnly:   false
  config:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      nginx-config
    Optional:  false
  default-token-4cv6p:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-4cv6p
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age        From               Message
  ----     ------            ----       ----               -------
  Warning  FailedScheduling  <unknown>  default-scheduler  persistentvolumeclaim "code" not found
  Warning  FailedScheduling  <unknown>  default-scheduler  persistentvolumeclaim "code" not found

And with kubectl config set-context --current --namespace=NAMESPACE I can set my namespace default I found out at https://stackoverflow.com/questions/54902676/can-i-set-a-default-namespace-in-kubernetes . So I used kubectl config set-context --current --namespace=smt-prod and now I can “forget” the namespace.

So it seems my Persistent Volume Claim code cannot be found.

So I removed the deployments and rebuilt them after I had the persistent volume claim set up. But now I am seeing

  Type     Reason            Age        From               Message
  ----     ------            ----       ----               -------
  Warning  FailedScheduling  <unknown>  default-scheduler  running "VolumeBinding" filter plugin for pod "web-d8b69f76f-2b9fp": pod has unbound immediate PersistentVolumeClaims
  Warning  FailedScheduling  <unknown>  default-scheduler  running "VolumeBinding" filter plugin for pod "web-d8b69f76f-2b9fp": pod has unbound immediate PersistentVolumeClaims

Perhaps because I have

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: code
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 50Gi
  storageClassName: do-block-storage

and locally I need a local path and no DigitalOcean Storage class name. But how? And why would I need a PVC if the Docker Image uses a work directory or its own PVC? What is wisdom here?