Skip to content

Commit

Permalink
Update bootstrap script to add --container-runtime
Browse files Browse the repository at this point in the history
typo
  • Loading branch information
rothgar committed Apr 27, 2021
1 parent 189baaa commit 2223e3e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions files/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function print_help {
echo "--dns-cluster-ip Overrides the IP address to use for DNS queries within the cluster. Defaults to 10.100.0.10 or 172.20.0.10 based on the IP address of the primary interface"
echo "--pause-container-account The AWS account (number) to pull the pause container from"
echo "--pause-container-version The tag of the pause container"
echo "--container-runtime Specify a container runtime (default: dockerd)"
}

POSITIONAL=()
Expand Down Expand Up @@ -87,6 +88,11 @@ while [[ $# -gt 0 ]]; do
shift
shift
;;
--container-runtime)
CONTAINER_RUNTIME=$2
shift
shift
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
Expand All @@ -109,6 +115,7 @@ ENABLE_DOCKER_BRIDGE="${ENABLE_DOCKER_BRIDGE:-false}"
API_RETRY_ATTEMPTS="${API_RETRY_ATTEMPTS:-3}"
DOCKER_CONFIG_JSON="${DOCKER_CONFIG_JSON:-}"
PAUSE_CONTAINER_VERSION="${PAUSE_CONTAINER_VERSION:-3.1-eksbuild.1}"
CONTAINER_RUNTIME="${CONTAINER_RUNTIME:-dockerd}"

function get_pause_container_account_for_region () {
local region="$1"
Expand Down Expand Up @@ -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
[Service]
ExecStart=
ExecStart=/usr/bin/kubelet --cloud-provider aws \
--config /etc/kubernetes/kubelet/kubelet-config.json \
--kubeconfig /var/lib/kubelet/kubeconfig \
--container-runtime remote \
--container-runtime-endpoint "unix:///run/containerd/containerd.sock" \
--network-plugin cni $KUBELET_ARGS $KUBELET_EXTRA_ARGS
EOF
elif [[ "$CONTAINER_RUNTIME" -ne "dockerd" ]]; then
echo "Container runtime ${CONTAINER_RUNTIME} is not supported."
fi

# Replace with custom docker config contents.
if [[ -n "$DOCKER_CONFIG_JSON" ]]; then
mkdir -p /etc/docker
Expand Down

0 comments on commit 2223e3e

Please sign in to comment.