Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add crictl tools in image #21

Closed

Conversation

neo-liang-sap
Copy link
Contributor

@neo-liang-sap neo-liang-sap commented Apr 1, 2020

What this PR does / why we need it:

Add crictl tools in ops-toolbelt image
Which issue(s) this PR fixes:
Fixes #19
Special notes for your reviewer:

Release note:

add crictl tools in ops-toolbelt image, detailed info could be found via https://github.com/kubernetes-sigs/cri-tools

@neo-liang-sap neo-liang-sap requested a review from a team as a code owner April 1, 2020 05:56
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Apr 1, 2020
@gardener-robot-ci-3 gardener-robot-ci-3 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Apr 1, 2020
@neo-liang-sap neo-liang-sap mentioned this pull request Apr 6, 2020
- name: crictl
command: |
VERSION="v1.17.0";\
curl -fsSLO https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz;\

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with this installation approach is that crictl is only needed in Gardener to communicate with containerd CRI. However the crictl default configuration points to docker. Crictl in Gardener should point per default to containerd. If containerd is not installed crictl will not work, but that is fine as the user can just use the regular docker commands then.
Please create the config file for crictl having the configuration for containerd.
Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @danielfoehrKn , thanks for the comments, i've added one config pointing to unix:///run/containerd/containerd.sock and copy the config file to crictl default config location in /etc/crictl.yaml

@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Apr 6, 2020
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
debug: true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what this configuration parameter is used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i got this sample from https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/crictl.md - i haven't used crictl before so do let me know if i need to remove some of the configs...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently the flag --debug enables debug output for crictl itself. So lets not use include that per default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, i've removed debug line from the config

@@ -131,7 +131,9 @@
VERSION="v1.17.0";\
curl -fsSLO https://github.com/kubernetes-sigs/cri-tools/releases/download/$VERSION/crictl-$VERSION-linux-amd64.tar.gz;\
tar zxvf crictl-$VERSION-linux-amd64.tar.gz -C /usr/local/bin;\
rm -f crictl-$VERSION-linux-amd64.tar.gz
rm -f crictl-$VERSION-linux-amd64.tar.gz;\
rm -rf /etc/crictl.yaml;\

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should not delete an existing configuration on the node. What do you think about only adding it when it is not available yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i checked this file status before cp the new one - the installation process of crictl doesn't create config if you don't run it, after you first time run crictl it will create an /etc/crictl.yaml which contains one line of null in it.
the default config will point to unix:///var/run/dockershim.sock which is not desired containerd

what do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is that, whenever an operator launches another ops/toolbelt pod, this will override the current /etc/crictl.yaml file on the host.
But thinking about it, that might be even better.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up on this: there are cases when the node image already got crictl installed- so overriding an already existing config should be avoided. PN me for more details.

@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Apr 6, 2020
Copy link

@danielfoehrKn danielfoehrKn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks

@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Apr 6, 2020
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Apr 6, 2020
@neo-liang-sap
Copy link
Contributor Author

thanks, i've squash into one commit, can someone from code owner have a review on this PR? thanks ;)

@petersutter
Copy link
Member

@danielfoehrKn @neo-liang-sap have you tried it out if it works?

Copy link

@danielfoehrKn danielfoehrKn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing that came to my mind: installing crictl when the pod is a non-root pod does not make sense. Can that somehow be turned off when running in non-root?

@petersutter dashboard deployed pods are always running as non-root correct? So crictl would not make sense for the dashboard?

@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Apr 9, 2020
@neo-liang-sap
Copy link
Contributor Author

neo-liang-sap commented Apr 9, 2020

Hi @petersutter @danielfoehrKn ,
I added some change to installation logic - check if running as non-root and whether crictl already installed.

I tested locally using .ci/build to build docker file and docker build an local image to run (docker run -it xxxx) and verified.

I also tried run hacks/ops-pod -i local_image_name node_name but seems the ops-pod can't pull image from my local but needs to pull image from GCR which i don't have access

Thanks and do let me know if there's other scenario i didn't covered/tested

@petersutter
Copy link
Member

The pipeline always pushes the image to gcr, here it is for your latest commit eu.gcr.io/gardener-project/gardener/ops-toolbelt:0.10.0-dev-8a2137cd0491a01992e554e814f2484709516d02

@neo-liang-sap
Copy link
Contributor Author

neo-liang-sap commented Apr 9, 2020

Hi @petersutter, thanks, i've tested on one shoot node and it's working, also verified the config file in /etc/crictl.yaml
image

BTW i never got access to ci/publish and other jobs (e.g.)https://concourse.ci.gardener.cloud/builds/29092 , after i tried login with github username/password i got 404 not found - whom should i refer to apply for (maybe) i'm lacking permission to access the CI?

thanks

@petersutter
Copy link
Member

@petersutter dashboard deployed pods are always running as non-root correct? So crictl would not make sense for the dashboard?

@danielfoehrKn the ops-toolbelt is run by default as non-root, however in the settings you can enable the Privileged mode. So criticl should work.
Screenshot 2020-04-10 at 13 11 24
Do you have containerd somewhere running to test this image agains it?

@danielfoehrKn
Copy link

danielfoehrKn commented Apr 10, 2020

@petersutter thats actually a super cool feature that I did not know about (maybe it could be somehow more prominent with a checkbox or something - just an idea). Yes I got a containerd installation on my local setup. Will try it out soon and update here.

@petersutter
Copy link
Member

@danielfoehrKn did you have the time to try it out?

@petersutter
Copy link
Member

petersutter commented Apr 27, 2020

Another thing that came to my mind: installing crictl when the pod is a non-root pod does not make sense. Can that somehow be turned off when running in non-root?

@neo-liang-sap have you checked if this is possible?

@gardener-robot gardener-robot removed the needs/rebase Needs git rebase label Jun 29, 2021
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jun 29, 2021
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jun 29, 2021
@gardener-robot gardener-robot added size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py) and removed size/s Size of pull request is small (see gardener-robot robot/bots/size.py) labels Jun 29, 2021
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Jun 29, 2021
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jun 29, 2021
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jun 29, 2021
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jun 29, 2021
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jun 29, 2021
@neo-liang-sap
Copy link
Contributor Author

PR are modified based on review comments

@gardener-robot gardener-robot added the lifecycle/rotten Nobody worked on this for 12 months (final aging stage) label Jun 29, 2021
@neo-liang-sap
Copy link
Contributor Author

conflicts resolved

@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jun 29, 2021
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Jun 29, 2021
@plkokanov
Copy link
Contributor

Meanwhile, I personally would not bother with crictl anymore but use nerdctl for container instead.

@danielfoehrKn what are the benefits? Probably we can close this PR and open a new one for nerdctl.

@danielfoehrKn
Copy link

nerdctl is a docker-compatible CLI for containerd. And containerd is the only CRI compatible container runtime Gardener supports at the moment.
It is much easier to deal with compared to crictl - which focuses on low-level CRI interactions. It is mostly a debug tool for CRI.

@neo-liang-sap
Copy link
Contributor Author

so what's the decision? i'm totally fine with closing this PR and work on a new ticket for nerdctl
@plkokanov @danielfoehrKn

@plkokanov
Copy link
Contributor

@jfortin-sap, let's close this PR and open a new one for nerdctl. Tbh the chang shouldn't be much different than the current one. Again, just add in the info field some help text about how one can connect to the container runtime by using .sock files from the host's root directory.

@neo-liang-sap
Copy link
Contributor Author

@plkokanov i guess you were to mentioning me but not Jonathan ;) , sure i will follow up

@plkokanov
Copy link
Contributor

Yeah, oops @neo-liang-sap, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Nobody worked on this for 12 months (final aging stage) needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py) status/author-action Issue requires issue author action
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add crictl
8 participants