aquasecurity / kube-bench

Checks whether Kubernetes is deployed according to security best practices as defined in the CIS Kubernetes Benchmark
Apache License 2.0
7.08k stars 1.23k forks source link

ARGs aren't set when running DOCKERFILE #1684

Closed AndrewWSHenry closed 1 month ago

AndrewWSHenry commented 2 months ago

Discussed in https://github.com/aquasecurity/kube-bench/discussions/1683

Originally posted by **AndrewWSHenry** September 18, 2024 hi, I have not been able to build the kube-bench container using the instructions for "Running CIS benchmark in an EKS cluster" [https://github.com/aquasecurity/kube-bench/blob/main/docs/running.md#running-cis-benchmark-in-an-eks-cluster](url). I have run the docker build command on Ubuntu 24.04 and OpenSUSE LEAP 15.6 and run into the same problem of the KUBECTL_VERSION ARG not being set/available. causing the wget to error. The instructions don't mention a need to set those values and a brief look seems to suggest that the makefile run by the dockerfile should be setting those values. Just wondering if anyone is aware of a reason why the KUBECTL_VERSION arg has no value? This is the relevant output. > Dockerfile:14 > -------------------- > 12 | # Add kubectl to run policies checks > 13 | ARG KUBECTL_VERSION TARGETARCH > 14 | >>> RUN wget -O /usr/local/bin/kubectl "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl" > 15 | RUN wget -O kubectl.sha256 "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl.sha256" > 16 | # Verify kubectl sha256sum > -------------------- > ERROR: failed to solve: process "/bin/sh -c wget -O /usr/local/bin/kubectl \"https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl\"" did not complete successfully: exit code: 8
mozillazg commented 1 month ago

@AndrewWSHenry Thanks for reporting. We should add a default value for the KUBECTL_VERSION arg in the Dockerfile. Feel free to send a pull request for this. Thanks!

afdesk commented 1 month ago

1648 should fix this issue.

@AndrewWSHenry could you confirm that It's OK for you? thanks!

afdesk commented 1 month ago

closed in favor of #1648 and was confirmed https://github.com/aquasecurity/kube-bench/discussions/1683#discussioncomment-10894251

please feel free to reopen this issue if it appears again.

thanks!