Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
aws: configure kubelet cgroup driver dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
schu committed May 9, 2019
1 parent 8bdf02d commit 22fb201
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions aws/container-linux/kubernetes/cl/controller.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ systemd:
ExecStartPre=/bin/mkdir -p /var/lib/calico
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
ExecStartPre=/etc/kubernetes/configure-kubelet-cgroup-driver
ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/cache/kubelet-pod.uuid
ExecStart=/usr/lib/coreos/kubelet-wrapper \
--anonymous-auth=false \
Expand All @@ -81,6 +82,7 @@ systemd:
--cluster_dns=${cluster_dns_service_ip} \
--cluster_domain=${cluster_domain_suffix} \
--cni-conf-dir=/etc/kubernetes/cni/net.d \
--config=/etc/kubernetes/kubelet.config \
--exit-on-lock-contention \
--kubeconfig=/etc/kubernetes/kubeconfig \
--lock-file=/var/run/lock/kubelet.lock \
Expand Down Expand Up @@ -154,6 +156,19 @@ storage:
--net=host \
--dns=host \
--exec=/bootkube -- start --asset-dir=/assets "$@"
- path: /etc/kubernetes/configure-kubelet-cgroup-driver
filesystem: root
mode: 0744
contents:
inline: |
#!/bin/bash
set -e
readonly docker_cgroup_driver="$(docker info | awk '/^Cgroup Driver/ { print $3 }')"
cat <<EOF >/etc/kubernetes/kubelet.config
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: "$${docker_cgroup_driver}"
EOF
passwd:
users:
- name: core
Expand Down
15 changes: 15 additions & 0 deletions aws/container-linux/kubernetes/workers/cl/worker.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ systemd:
ExecStartPre=/bin/mkdir -p /var/lib/calico
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
ExecStartPre=/etc/kubernetes/configure-kubelet-cgroup-driver
ExecStartPre=-/usr/bin/rkt rm --uuid-file=/var/cache/kubelet-pod.uuid
ExecStart=/usr/lib/coreos/kubelet-wrapper \
--anonymous-auth=false \
Expand All @@ -59,6 +60,7 @@ systemd:
--cluster_dns=${cluster_dns_service_ip} \
--cluster_domain=${cluster_domain_suffix} \
--cni-conf-dir=/etc/kubernetes/cni/net.d \
--config=/etc/kubernetes/kubelet.config \
--exit-on-lock-contention \
--kubeconfig=/etc/kubernetes/kubeconfig \
--lock-file=/var/run/lock/kubelet.lock \
Expand Down Expand Up @@ -104,6 +106,19 @@ storage:
contents:
inline: |
fs.inotify.max_user_watches=16184
- path: /etc/kubernetes/configure-kubelet-cgroup-driver
filesystem: root
mode: 0744
contents:
inline: |
#!/bin/bash
set -e
readonly docker_cgroup_driver="$(docker info | awk '/^Cgroup Driver/ { print $3 }')"
cat <<EOF >/etc/kubernetes/kubelet.config
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: "$${docker_cgroup_driver}"
EOF
- path: /etc/kubernetes/delete-node
filesystem: root
mode: 0744
Expand Down

0 comments on commit 22fb201

Please sign in to comment.