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 additional utilities to kubectl image #119592

Merged

Conversation

rayandas
Copy link
Member

@rayandas rayandas commented Jul 26, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

This PR adds additional utilities into the kubectl image

Which issue(s) this PR fixes:

Related #119567

Does this PR introduce a user-facing change?

The Dockerfile for the kubectl image has been updated with the addition of a specific base image and essential utilities (bash and jq).

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. labels Jul 26, 2023
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.28 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.28.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Wed Jul 26 10:09:28 UTC 2023.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 26, 2023
@rayandas rayandas changed the title add additional utilities Add additional utilities to kubectl image Jul 26, 2023
@rayandas rayandas force-pushed the rayandas-kubectl-image-update branch from 24c70e0 to 109be70 Compare July 26, 2023 13:40
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 26, 2023
@dims dims changed the title Add additional utilities to kubectl image [WIP] Add additional utilities to kubectl image Jul 26, 2023
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 26, 2023
@xmudrii
Copy link
Member

xmudrii commented Jul 26, 2023

Hey @rayandas, thank you for your PR! I think those utilities are useful in the kubectl image. We usually tend to avoid images with shell by using distroless, but that might not be ideal for kubectl. However, I'd prefer changing the base image rather than adding tools one by one. We should use the base image that provides more tools out of the box and I think debian-base image that we ship is a good candidate: registry.k8s.io/build-image/debian-base:bookworm-v1.0.0

I'd also like other RelEng folks to take a look at this PR and provide their feedback, so I'm going to cc them.
cc @kubernetes/release-engineering

@rayandas
Copy link
Member Author

@xmudrii Sure, that sounds good.

@rayandas rayandas force-pushed the rayandas-kubectl-image-update branch from 109be70 to 6b33e8e Compare July 27, 2023 05:30
@palnabarun
Copy link
Member

@rayandas Can you also add a release note since this is a user facing change?

@palnabarun
Copy link
Member

/priority important-longterm
/triage accepted

@k8s-ci-robot k8s-ci-robot added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 27, 2023
@palnabarun
Copy link
Member

/sig cli
/sig release

@k8s-ci-robot k8s-ci-robot added sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/release Categorizes an issue or PR as relevant to SIG Release. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 27, 2023
@rayandas
Copy link
Member Author

@palnabarun Sure thing. I will add a release note.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2023
@rayandas
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2023
@bart0sh bart0sh moved this from Triage to Needs Reviewer in SIG Node PR Triage Aug 2, 2023
@ndixita ndixita moved this from Triage to Archive-it in SIG Node CI/Test Board Aug 2, 2023
ARG BINARY


FROM "${BASEIMAGE}"
FROM registry.k8s.io/build-image/debian-base:bookworm-v1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

@rayandas Can you explain why do we change base image? Can we simply install packages that we need?

Copy link
Member Author

@rayandas rayandas Aug 24, 2023

Choose a reason for hiding this comment

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

The default image is distroless hence it doesn’t have a shell (that’s why installing any package on the distroless image was failing). So I used the debian base image suggested by @xmudrii
Please go through his comment above.
Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanations. Now it makes sense to me.

@bart0sh bart0sh moved this from Needs Reviewer to Needs Approver in SIG Node PR Triage Aug 24, 2023
@bart0sh
Copy link
Contributor

bart0sh commented Aug 24, 2023

/lgtm

@dims
Copy link
Member

dims commented Aug 27, 2023

/approve
/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, rayandas, saschagrunert, xmudrii

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 27, 2023
@k8s-ci-robot k8s-ci-robot merged commit b4db99e into kubernetes:master Aug 27, 2023
12 checks passed
SIG Node PR Triage automation moved this from Needs Approver to Done Aug 27, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.29 milestone Aug 27, 2023
@BenTheElder
Copy link
Member

This is pretty much the opposite of our usual distroless-ish images and will have a lot of packages to patch, do we really need all of these utilities? Is there discussion of this list somewhere?

@xmudrii
Copy link
Member

xmudrii commented Aug 28, 2023

@BenTheElder This is a good point, this is indeed opposite of how we handle images usually. However, this also a bit specific image. Using kubectl without a shell can make user experience bad and limited. Not only that you have to spawn a new container for each command, you're also very limited in terms of what you can do with output. My opinion is that if we ship a kubectl image, it should include shell and the most frequently used tools, otherwise there's no much value in shipping a kubectl image.

I remember some smaller discussions about this on Slack, but I can't find anything. If you think we should discuss this more in-depth, I recommend proposing this as a topic for one of the next SIG Release meetings. 🙂

@BenTheElder
Copy link
Member

I think we should be tagging SIG CLI and that the building of the image is not owned by them but the choice of which tools are available probably should be with input from both.

@BenTheElder
Copy link
Member

BenTheElder commented Aug 28, 2023

Users are also free to extend the image and lots of kubectl commands do work without any of these tools just fine and now those users have to pay for a much larger and potentially vulnerable image. The issue discussed two distinct use cases

rayandas added a commit to rayandas/kubernetes that referenced this pull request Aug 28, 2023
@xmudrii
Copy link
Member

xmudrii commented Aug 28, 2023

I think we should be tagging SIG CLI and that the building of the image is not owned by them but the choice of which tools are available probably should be with input from both.

I agree that we should involve SIG CLI here as well.

Users are also free to extend the image and lots of kubectl commands do work without any of these tools just fine and now those users have to pay for a much larger and potentially vulnerable image. The issue discussed two distinct use cases

This statement works both ways. Users are also free to build kubectl without any tools if vulnerabilities are their concern.

We have to make a clear distinction here: this is a client image. Client images should be:

  • short-running, do something and remove the container
  • optimized for user experience and manual interaction as much as possible (this means shell and more tools)

Reality is that this image is going to be affected by vulnerabilities, but reality is also that (almost) none of those vulnerabilities will ever be exploitable in this context. Again, if someone finds this a blocker, I think it's fair to say "please build your own image without any tools, we want to optimize for user experience here".

Then again, I think we need inputs from and on:

  • SIG Release: what constitutes a "client image"
  • SIG CLI: what tools should we ship as part of that image

Some middle-ground approach might be two build two different images (with and without tools), but I'm not sure I'm fan of that.

@thockin
Copy link
Member

thockin commented Aug 28, 2023

One point of disagreement: I would. Like to use this to tell people "run it as a sidecar". It's a clean way to get arbitrary info from the API, subject to your own pod's ServiceAccount and RBAC (important!), and publish it to another container which doesn't understand kube directly.

It's like downward API, but without having to ask kubelet to respect the pod's RBAC

@sftim
Copy link
Contributor

sftim commented Aug 29, 2023

If we publish tooling (eg a Dockerfile) that helps you make your own image using the kubectl from our image, that feels like a nice balance to me.

@bart0sh bart0sh moved this from Done to Triage in SIG Node PR Triage Aug 29, 2023
@bart0sh bart0sh moved this from Triage to Done in SIG Node PR Triage Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/release Categorizes an issue or PR as relevant to SIG Release. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

10 participants