Skip to content

Commit

Permalink
kubeadm: write "cgroupfs" in the kubelet config
Browse files Browse the repository at this point in the history
Cgroup drivers should be ignored on Windows but there is a bug
in the kubelet:
  kubernetes/kubernetes #97759

Workaround this bug by patching the kubelet configuration in
the cluster.
  • Loading branch information
neolit123 committed Jan 25, 2021
1 parent 00012ee commit 49a690c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions kubeadm/hack/e2e-cluster-gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ sed -i "s/${privateIP}/${externalIP}/g" $KUBECONFIG
k8sVersion=$(kubectl version -ojson | jq -r .serverVersion.gitVersion)
sed "s/VERSION/${k8sVersion}/" "$REPO_ROOT/kubeadm/hack/startup/windows.ps1" > $scratchDir/windows.ps1

# Patch the cgroup driver in the kubelet config to be cgroupfs.
# Workaround for https://github.com/kubernetes/kubernetes/issues/97759
# This makes the joining Windows workers download a kubelet configuration that is compatible
# with the Docker defaults on Windows.
k8sVersionMajor=$(echo $k8sVersion | cut -d "." -f 1 | cut -c2-)
k8sVersionMinor=$(echo $k8sVersion | cut -d "." -f 2)
kubeletConfigName="kubelet-config-$k8sVersionMajor.$k8sVersionMinor"
kubeletTmpFile="/tmp/kubelet.yaml"
gcloud compute ssh "root@${ctrlPlaneNodeName}" --command "KUBECONFIG=/etc/kubernetes/admin.conf kubectl get cm -n kube-system $kubeletConfigName -o yaml > $kubeletTmpFile"
gcloud compute ssh "root@${ctrlPlaneNodeName}" --command "sed -i 's/cgroupDriver: systemd/cgroupDriver: cgroupfs/g' $kubeletTmpFile"
gcloud compute ssh "root@${ctrlPlaneNodeName}" --command "KUBECONFIG=/etc/kubernetes/admin.conf kubectl replace -f $kubeletTmpFile"

set +o xtrace
joinCmd="$(gcloud compute ssh root@${ctrlPlaneNodeName} --command "kubeadm token create --print-join-command") --ignore-preflight-errors=IsPrivilegedUser"

Expand Down

0 comments on commit 49a690c

Please sign in to comment.