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

Container runtime bootstrap #656

Closed
wants to merge 1 commit into from

Conversation

rothgar
Copy link

@rothgar rothgar commented Apr 27, 2021

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 of dockerd 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.

@pavan-tri
Copy link

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

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

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

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.

[1] https://linux.die.net/man/1/bash

@8enmann
Copy link

8enmann commented Jul 15, 2021

What's the status here? Would love to get this in

@heybronson
Copy link
Contributor

#698 has addressed changing container runtime on node bootstrap.

@ravisinha0506
Copy link
Contributor

Going to close this PR in favor of #698.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants