CRI-tools
Conventionally, container engines come equipped with a command-line tool to help users debug applications and simplify troubleshooting. For instance, when Docker is employed as the container runtime, you can use the docker
command to inspect the status of containers and images and verify the accuracy of a container's configuration. But what if you're using other container engines? Here's when crictl
comes in as an outstanding substitute for the docker
tool.
Crictl
is a part of cri-tools and functions much like the docker
command line. It offers the direct advantage of being able to communicate with the container runtime via CRI, without the need for Kubelet. Designed specifically for Kubernetes, it is efficient at managing resources such as Pods, containers, and images. It aids both developers and users in debugging application issues and troubleshooting anomalies. Crictl
can be used with all container runtimes implementing CRI interfaces.
But don't mistake crictl
as a substitution for kubectl
; it solely communicates with the container runtime via the CRI and is useful for debugging and troubleshooting, not for executing containers. While crictl
does have commands to run Pods and containers, it's recommended to use them for debugging purposes only. Be cautious; if you create new Pods on a Kubernetes Node, Kubelet will stop and delete them.
Moving beyond crictl
, cri-tools also provides a validation test tool critest
, which checks whether the container runtime has implemented the necessary CRI features. Critest
ensures that the implementation of the container runtime aligns with Kubelet's requirements by conducting an array of tests. This highly recommended tool should run its tests on all container runtimes before release. In most cases, critest
is a part of integrated container runtime testing, ensuring that any code updates won't damage CRI functionality.
CRI-tools officially had their General Availability (GA) release in Version 1.11. For detailed usage techniques, please refer to kubernetes-sigs/cri-tools and Debugging Kubernetes nodes with crictl.
A Sneak Peek at crictl in Action
Querying a Pod
Listing Pods
Listing Images
Listing Containers
Executing a Command Inside a Container
Checking Container Logs
Learn More
最后更新于