-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Container runtime bootstrap #656
Conversation
4ead78a
to
2223e3e
Compare
With K8S 1.20 in EKS, this is a important fix which needs attention, +1 |
@@ -392,6 +399,22 @@ Environment='KUBELET_EXTRA_ARGS=$KUBELET_EXTRA_ARGS' | |||
EOF | |||
fi | |||
|
|||
# Replace dockerd with containerd | |||
if [[ "$CONTAINER_RUNTIME" -eq "containerd" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rothgar I believe this is incorrect because -eq
operator is used for numeric comparison, not string comparison. [1] This should be=
.
[1] https://tldp.org/LDP/abs/html/comparison-ops.html#ICOMPARISON1
--container-runtime-endpoint "unix:///run/containerd/containerd.sock" \ | ||
--network-plugin cni $KUBELET_ARGS $KUBELET_EXTRA_ARGS | ||
EOF | ||
elif [[ "$CONTAINER_RUNTIME" -ne "dockerd" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before, we should be using =
not -ne
because this is for numeric comparison and will fail.
@@ -392,6 +399,22 @@ Environment='KUBELET_EXTRA_ARGS=$KUBELET_EXTRA_ARGS' | |||
EOF | |||
fi | |||
|
|||
# Replace dockerd with containerd | |||
if [[ "$CONTAINER_RUNTIME" -eq "containerd" ]]; then | |||
cat <<EOF > /etc/systemd/system/kubelet.service.d/50-kubelet-container-runtime.conf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to quote the EOF
like cat <<'EOF'
else it will try to expand the variable KUBELET_ARGS
and fail because the variable is not defined. See man bash [1]:
If any characters in word are quoted, the delimiter is the result of quote removal on word, and the lines in the here-document are not expanded. If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion.
What's the status here? Would love to get this in |
#698 has addressed changing container runtime on node bootstrap. |
Going to close this PR in favor of #698. |
Issue #, if available: aws/containers-roadmap#313 and eksctl-io/eksctl#3572
Description of changes:
Add a
--container-runtime
flag to the bootstrap.sh script to help make container runtime switching consistent. Provides a default ofdockerd
which performs no actions with the current AL2 AMI defaults and eventually can be switched to default to containerd with an optional switch to dockerd.