Error in the inspect of the container id of the container

Hi Team, I have created a pod busybox with yaml file mentioned below:

apiVersion: v1
kind: Pod
metadata:
  name: busybox
spec:
  containers:
  - image: busybox
    name: busybox
    command: ["sleep", "3000"]
    volumeMounts:
    - mountPath: /cache
      name: cache-volume
  volumes:
  - name: cache-volume
    emptyDir: {}
$ k apply -f test.yaml
pod/busybox created


controlplane ~ ✖ k get pods
NAME      READY   STATUS    RESTARTS   AGE
busybox   1/1     Running   0          20m

controlplane ~ ➜  kubectl describe pod busybox | grep -i "container id"
    Container ID:  containerd://37860175d71a5ba9aeb825a3161c81171f638b22ee49e824bec0cdc2c303347d

controlplane ~ ➜  crictl ps -a | grep "37860175d71a5ba9aeb825a3161c81171f638b22ee49e824bec0cdc2c303347d"

controlplane ~ ✖ crictl inspect 37860175d71a5ba9aeb825a3161c81171f638b22ee49e824bec0cdc2c303347d
E0415 08:15:56.531686   18176 log.go:32] "ContainerStatus from runtime service failed" err="rpc error: code = NotFound desc = an error occurred when try to find container \"37860175d71a5ba9aeb825a3161c81171f638b22ee49e824bec0cdc2c303347d\": not found" containerID="37860175d71a5ba9aeb825a3161c81171f638b22ee49e824bec0cdc2c303347d"
FATA[0000] get the status of containers: get container status: rpc error: code = NotFound desc = an error occurred when try to find container "37860175d71a5ba9aeb825a3161c81171f638b22ee49e824bec0cdc2c303347d": not found 

Kindly let me know why the container ID is not reported in the crictl ps command ?

Thanks,
Sakshi

it’s likely pointing to the wrong socket. Set the correct socket with crictl config --set runtime-endpoint=unix:///run/containerd/containerd.sock and make sure containerd is running with systemctl status containerd.

If you’re doing this as part of a lab, please share the lab link so I can get more context and help you better.

Hi @sakshibag80

You are checking for the container on the Controlplane node. You need to check on the Node the Pod is scheduled and there you will find the container.

1 Like

Hi,

The reason crictl ps -a is not showing the container ID from kubectl describe pod is likely due to a runtime mismatch.

Kubernetes is reporting the container using the containerd:// prefix, which means it’s using containerd as the container runtime. However, crictl must be properly configured to communicate with containerd via the correct socket.

To fix this, check or set the runtime endpoint for crictl:

bash

CopyEdit

crictl config --set runtime-endpoint=unix:///run/containerd/containerd.sock

Then try:

bash

CopyEdit

crictl ps -a | grep <container-id>

If you’re still not seeing the container, also ensure the pod hasn’t restarted or exited between your kubectl and crictl commands.

Thanks @Santosh_KodeKloud.

I checked this on the correct node and was able to view this.

Regards,
Sakshi