Skip to content

Commit

Permalink
Fail fast if we cannot determine kubelet version (#1484)
Browse files Browse the repository at this point in the history
kubelet is likely to fail when there is a mismatch with GLIBC that is in
the image vs the one golang uses to build the kubelet. So fail the image
right away when this happens as this specific kubelet binary will NOT work
in any instance started with this image.
```
2023-10-25T10:11:38-04:00:     amazon-ebs: kubelet: /lib64/libc.so.6: version `GLIBC_2.32' not found (required by kubelet)
2023-10-25T10:11:38-04:00:     amazon-ebs: kubelet: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by kubelet)
```

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
  • Loading branch information
dims authored Oct 26, 2023
1 parent a181b02 commit 967fb36
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions scripts/generate-version-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@ OUTPUT_FILE="$1"
sudo rpm --query --all --queryformat '\{"%{NAME}": "%{VERSION}-%{RELEASE}"\}\n' | jq --slurp --sort-keys 'add | {packages:(.)}' > "$OUTPUT_FILE"

# binaries
echo $(jq ".binaries.kubelet = \"$(kubelet --version | awk '{print $2}')\"" $OUTPUT_FILE) > $OUTPUT_FILE
echo $(jq ".binaries.awscli = \"$(aws --version | awk '{print $1}' | cut -d '/' -f 2)\"" $OUTPUT_FILE) > $OUTPUT_FILE
KUBELET_VERSION=$(kubelet --version | awk '{print $2}')
if [ "$?" != 0 ]; then
echo "unable to get kubelet version"
exit 1
fi
echo $(jq ".binaries.kubelet = \"$KUBELET_VERSION\"" $OUTPUT_FILE) > $OUTPUT_FILE

CLI_VERSION=$(aws --version | awk '{print $1}' | cut -d '/' -f 2)
if [ "$?" != 0 ]; then
echo "unable to get aws cli version"
exit 1
fi
echo $(jq ".binaries.awscli = \"$CLI_VERSION\"" $OUTPUT_FILE) > $OUTPUT_FILE

# cached images
if systemctl is-active --quiet containerd; then
Expand Down

1 comment on commit 967fb36

@leowenlu
Copy link

@leowenlu leowenlu commented on 967fb36 Jan 3, 2024

Choose a reason for hiding this comment

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

I had workaround to add sudo in front of kubelet --version | awk '{print $2}, the workaround was to modify the sh file, kind of hacking.
Have raised {R here, however it looks like it will not get approved maybe.
https://github.com/awslabs/amazon-eks-ami/pull/1513/files
Maybe you could try the workaround?

Please sign in to comment.