Skip to content

Commit c31ec39

Browse files
chore: verify sha256sum of kubectl
This patch extends the installation of the kubectl binary to validate the checksum of the downloaded file, similar to what is already done for kind. This approach is also described as an optional step on https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-kubectl-binary-with-curl-on-linux. Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
1 parent a1b0e39 commit c31ec39

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kind.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,12 @@ install_kubectl() {
227227

228228
mkdir -p "${kubectl_dir}"
229229

230-
curl -sSLo "${kubectl_dir}/kubectl" "https://dl.k8s.io/release/${kubectl_version}/bin/linux/${arch}/kubectl"
231-
chmod +x "${kubectl_dir}/kubectl"
230+
pushd "${kubectl_dir}"
231+
curl -sSLo kubectl "https://dl.k8s.io/release/${kubectl_version}/bin/linux/${arch}/kubectl"
232+
curl -sSLo kubectl.sha256 "https://dl.k8s.io/release/${kubectl_version}/bin/linux/${arch}/kubectl.sha256"
233+
echo "$(cat kubectl.sha256) kubectl" | sha256sum -c
234+
chmod +x kubectl
235+
popd
232236
}
233237

234238
create_config_with_registry() {

0 commit comments

Comments
 (0)