-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix remove binaries script for Amazon Linux and Flatcar (#1176)
* Fix remove binaries script for Amazon Linux and Flatcar * Stop Kubelet before removing it * Force remove unit files * Reload systemd after removing units Without this, running apply after removing binaries wouldn't work because systemd service would still exist, so apply assumes that kubelet is installed. However, the binary is not available, which causes apply to fail to determine the kubelet version. Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com> * Update test fixtures Signed-off-by: Marko Mudrinić <mudrinic.mare@gmail.com>
- Loading branch information
Showing
3 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
set -xeu pipefail | ||
export "PATH=$PATH:/sbin:/usr/local/bin:/opt/bin" | ||
|
||
# Stop kubelet | ||
sudo systemctl stop kubelet || true | ||
# Remove CNI and binaries | ||
sudo rm -rf /opt/cni /opt/bin/kubeadm /opt/bin/kubectl /opt/bin/kubelet | ||
# Remove symlinks | ||
sudo rm -rf /usr/bin/kubeadm /usr/bin/kubectl /usr/bin/kubelet | ||
# Remove systemd unit files | ||
sudo rm /etc/systemd/system/kubelet.service /etc/systemd/system/kubelet.service.d/10-kubeadm.conf | ||
sudo rm -f /etc/systemd/system/kubelet.service /etc/systemd/system/kubelet.service.d/10-kubeadm.conf | ||
# Reload systemd | ||
sudo systemctl daemon-reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
set -xeu pipefail | ||
export "PATH=$PATH:/sbin:/usr/local/bin:/opt/bin" | ||
|
||
# Stop kubelet | ||
sudo systemctl stop kubelet || true | ||
# Remove CNI and binaries | ||
sudo rm -rf /opt/cni /opt/bin/kubeadm /opt/bin/kubectl /opt/bin/kubelet | ||
# Remove systemd unit files | ||
sudo rm /etc/systemd/system/kubelet.service /etc/systemd/system/kubelet.service.d/10-kubeadm.conf | ||
sudo rm -f /etc/systemd/system/kubelet.service /etc/systemd/system/kubelet.service.d/10-kubeadm.conf | ||
# Reload systemd | ||
sudo systemctl daemon-reload |