Hugo Future Imperfect Slim

Tech Notes

Linux,MAC,Docker,Kubernetes,
CloudStack,AWS,GCP,AZURE,
Raspberrypi,VMWARE,GO,BOOKS,
NETFLIX,Movies,Seasons

2-Minute Read

With the removal docker as the default container runtime in kubernetes.

When a situation arises where you need to debug the container application container

You can use Crictl and Nerdctl and debug the issue quickly

Crictl

  1. Install crictl
VERSION="v1.22.0"
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin

  1. Create a endpoint configuration file (crictl.yaml)

Example

To interact with containerd runtime env

cat /etc/crictl.yaml 
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 2
debug: false
pull-image-on-create: false

To interact with docker runtime

cat /etc/crictl.yaml
runtime-endpoint: unix:///var/run/dockershim.sock
image-endpoint: unix:///var/run/dockershim.sock
timeout: 2
debug: false
pull-image-on-create: false

To interact with Crio runtime

cat /etc/crictl.yaml
runtime-endpoint: unix:///run/crio/crio.sock
image-endpoint: unix:///run/crio/crio.sock
timeout: 2
debug: false

  1. Execute the crictl commands

Example:

kiran@master1:~$ sudo crictl --help
kiran@master1:~$ sudo crictl info
kiran@master1:~$ sudo crictl info
kiran@master1:~$ sudo crictl inspect <>
kiran@master1:~$ sudo crictl pods

Nerdctl

While critctl is great its not compatible with Docker CLI, not friendly to users, and does not support non-CRI features

Currently nerdctl runs with containerd runtime

https://github.com/containerd/nerdctl

  1. Installing
wget https://github.com/containerd/nerdctl/releases/download/v0.11.1/nerdctl-0.11.1-linux-amd64.tar.gz

sudo tar Cxzvvf /usr/local/bin nerdctl-0.11.1-linux-amd64.tar.gz 

  1. Commands
sudo nerdctl version

sudo nerdctl system info 

sudo nerdctl help 

nerdctl --namespace k8s.io ps -a

nerdctl run -d --name nginx -p 8080:80 nginx:alpine
nerdclt ps 
nerdctl logs -f <>

nerdctl compose up -d
nerdctl top <>
nerdctl volume ls
nerdctl volume inspect
nerdctl network -h 

nerdctl port <>

Ref: https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/

https://github.com/containerd/nerdctl

https://github.com/containerd/nerdctl/releases

A good video which talks about it

comments powered by Disqus

Recent Posts

Kind

Categories

About

I am a Software Engineer at Persistent Systems, working on Cloud Stack Orchestration and various tech related to Cloud Infra, container technology like Docker, Kubernetes