cri-o icon indicating copy to clipboard operation
cri-o copied to clipboard

Add tutorial showing how to run CRI-O in kind

Open roman-kiselenko opened this issue 1 year ago • 9 comments

What type of PR is this?

/kind documentation

What this PR does / why we need it:

Small tutorial: How to run CRI-O as container runtime in kind.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

None

Does this PR introduce a user-facing change?

None

roman-kiselenko avatar May 13 '24 17:05 roman-kiselenko

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: roman-kiselenko Once this PR has been reviewed and has the lgtm label, please assign kolyshkin for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar May 13 '24 17:05 openshift-ci[bot]

@cri-o/cri-o-maintainers PTAL 🙏

roman-kiselenko avatar May 13 '24 17:05 roman-kiselenko

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 49.54%. Comparing base (9712c53) to head (1e12bed). Report is 40 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8170      +/-   ##
==========================================
- Coverage   49.58%   49.54%   -0.04%     
==========================================
  Files         153      153              
  Lines       16930    16961      +31     
==========================================
+ Hits         8394     8404      +10     
- Misses       7489     7510      +21     
  Partials     1047     1047              

codecov[bot] avatar May 13 '24 17:05 codecov[bot]

thanks! you've got some markdown lint failures

haircommander avatar May 13 '24 19:05 haircommander

@roman-kiselenko, given that it's based on your excellent blog post, feel free to ignore my suggestions for the changes to the way how "kind" is styled.

kwilczynski avatar May 14 '24 12:05 kwilczynski

Awesome! We could keep this updated for newer versions on main branch and release branches will retain version specific instructions.

mrunalp avatar May 14 '24 16:05 mrunalp

One quick remark though; I have faced an issue with my configuration (I had docker configured to use buildx ...). I could not build the crio image if using build ...

@maiqueb, what sort of issue shave you had? Any errors you can share we could have a look at?

This might be something we want to fix, potentially.

kwilczynski avatar May 15 '24 02:05 kwilczynski

One quick remark though; I have faced an issue with my configuration (I had docker configured to use buildx ...). I could not build the crio image if using build ...

@maiqueb, what sort of issue shave you had? Any errors you can share we could have a look at?

This might be something we want to fix, potentially.

Sure thing @kwilczynski. The error happens when I try to build the CRIO img from the node image:

➜  new-cni-verbs-demo docker build --build-arg CRIO_VERSION=$CRIO_VERSION -t kindnode/crio:$CRIO_VERSION .
[+] Building 1.4s (2/2) FINISHED                                                                                    docker-container:kind-builder
 => [internal] load build definition from Dockerfile                                                                                         0.0s
 => => transferring dockerfile: 977B                                                                                                         0.0s
 => ERROR [internal] load metadata for docker.io/kindest/node:latest                                                                         1.2s
------
 > [internal] load metadata for docker.io/kindest/node:latest:
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:1
--------------------
   1 | >>> FROM kindest/node:latest
   2 |     
   3 |     ARG CRIO_VERSION
--------------------
ERROR: failed to solve: kindest/node:latest: failed to resolve source metadata for docker.io/kindest/node:latest: docker.io/kindest/node:latest: not found

# I'm using buildx
➜  new-cni-verbs-demo cat ~/.docker/config.json      
{
	"auths": {},
	"aliases": {
		"builder": "buildx"
	}
}# 

The weird thing IMO is the image is actually available in docker images:

➜  new-cni-verbs-demo docker images
REPOSITORY                                  TAG                                              IMAGE ID       CREATED         SIZE
...
kindest/node                                latest                                           7acfe6ceb949   28 hours ago    1.06GB
...

This was "fixed" by ... not using buildx :)

➜  new-cni-verbs-demo mv ~/.docker/config.json ~/.docker/config.jsonBACKUP 
➜  new-cni-verbs-demo docker build --build-arg CRIO_VERSION=$CRIO_VERSION -t kindnode/crio:$CRIO_VERSION .
[+] Building 0.3s (6/6) FINISHED                                                                                                   docker:default
 => [internal] load build definition from Dockerfile                                                                                         0.0s
 => => transferring dockerfile: 977B                                                                                                         0.0s
 => [internal] load metadata for docker.io/kindest/node:latest                                                                               0.0s
 => [internal] load .dockerignore                                                                                                            0.0s
 => => transferring context: 2B                                                                                                              0.0s
 => [1/2] FROM docker.io/kindest/node:latest                                                                                                 0.0s
 => CACHED [2/2] RUN echo "Installing Packages ..."     && apt-get clean     && apt-get update -y     && DEBIAN_FRONTEND=noninteractive apt  0.0s
 => exporting to image                                                                                                                       0.0s
 => => exporting layers                                                                                                                      0.0s
 => => writing image sha256:fe153b4a09c05031acc6dc4dc09ec5563df58f5d9332320b17a859918b0caf84                                                 0.0s
 => => naming to docker.io/kindnode/crio:v1.30              

I've also tried to use --load when building, to no avail:

➜  new-cni-verbs-demo mv ~/.docker/config.jsonBACKUP ~/.docker/config.json 
➜  new-cni-verbs-demo docker build --build-arg CRIO_VERSION=$CRIO_VERSION --load -t kindnode/crio:$CRIO_VERSION .
[+] Building 0.6s (2/2) FINISHED                                                                                    docker-container:kind-builder
 => [internal] load build definition from Dockerfile                                                                                         0.0s
 => => transferring dockerfile: 977B                                                                                                         0.0s
 => ERROR [internal] load metadata for docker.io/kindest/node:latest                                                                         0.4s
------
 > [internal] load metadata for docker.io/kindest/node:latest:
------
Dockerfile:1
--------------------
   1 | >>> FROM kindest/node:latest
   2 |     
   3 |     ARG CRIO_VERSION
--------------------
ERROR: failed to solve: kindest/node:latest: failed to resolve source metadata for docker.io/kindest/node:latest: docker.io/kindest/node:latest: not found

maiqueb avatar May 15 '24 18:05 maiqueb

@maiqueb Thank you for your tip; I've added the note about buildx.

roman-kiselenko avatar May 17 '24 13:05 roman-kiselenko

@maiqueb: changing LGTM is restricted to collaborators

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

openshift-ci[bot] avatar May 22 '24 11:05 openshift-ci[bot]

/approve

LGTM, thank you! @cri-o/cri-o-maintainers PTAL

haircommander avatar May 22 '24 14:05 haircommander

/approve /lgtm

kwilczynski avatar May 22 '24 15:05 kwilczynski

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, kwilczynski, maiqueb, roman-kiselenko

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

openshift-ci[bot] avatar May 22 '24 15:05 openshift-ci[bot]