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

Add support for containerd-config-file to bootstrap script #929

Merged
merged 1 commit into from
May 26, 2022

Conversation

suket22
Copy link
Member

@suket22 suket22 commented May 25, 2022

Issue #, if available:
This resolves #830 and #848
This PR continues the work from @codablock in #790

Description of changes:
Adds a new parameter to the bootstrap script --containerd-config-file that completely overrides the config to be used with containerd.
Note -

  • We will continue to do a sed replace on SANDBOX_IMAGE. This is useful in many contexts, including running in cn-north-1, cn-northwest-1 where you might want to pull the pause container from ECR due to network connectivity.
  • We will use the entire contents of the config file - in-line with how it works for --docker-config-json.

Testing

  • I created an AMI with these changes by running make 1.21
  • I launched a worker node using dockerd and containerd and made sure they join the cluster (no regressions)
  • I tested the parameter and made sure the node joined and the config was applied.

To replicate my results, create some custom userData first -

> cat user-data-crconfig.txt
#!/bin/bash -xe

cat <<EOF > /etc/eks/custom-containerd-config.toml
version = 2
root = "/var/lib/containerd"
state = "/run/containerd"

[grpc]
address = "/run/containerd/containerd.sock"

[plugins."io.containerd.grpc.v1.cri".containerd]
default_runtime_name = "runc"

[plugins."io.containerd.grpc.v1.cri"]
sandbox_image = "SANDBOX_IMAGE"
max_container_log_line_size = 10000

[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
runtime_type = "io.containerd.runc.v2"

[plugins."io.containerd.grpc.v1.cri".cni]
bin_dir = "/opt/cni/bin"
conf_dir = "/etc/cni/net.d"
EOF

/etc/eks/bootstrap.sh 'karp-cluster' \
--container-runtime containerd \
--containerd-config-file /etc/eks/custom-containerd-config.toml \
--kubelet-extra-args '--node-labels=test=foo'

and then launch an instance and see if it joins your cluster

> aws ec2 run-instances \
    --image-id ami-xxx \
    --instance-type t3.large \
    --count 1 \
    --subnet-id subnet-xxx \
    --security-group-ids sg-xxx \
    --iam-instance-profile Name=xx \
    --tag-specifications 'ResourceType=instance,Tags=[{Key=kubernetes.io/cluster/my-cluster,Value=owned}]' \
    --user-data file://user-data-crconfig.txt

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Member

@mmerkes mmerkes left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Make containerd config configurable
3 participants