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

Fix Vagrant provisioning via the shells scripts don't work because of legacy apt repository #1

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app-a/ch03/cluster-upgrade-version/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
vb.memory = 2048
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.25.6-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.25.6-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/control-plane.sh", args: "#{POD_CIDR} #{API_ADV_ADDRESS}"
end

Expand All @@ -27,7 +27,7 @@ Vagrant.configure("2") do |config|
vb.memory = 1024
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.25.6-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.25.6-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/worker.sh", args: "#{i}"
end
end
Expand Down
4 changes: 2 additions & 2 deletions app-a/ch04/apparmor/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
vb.memory = 2048
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/control-plane.sh", args: "#{POD_CIDR} #{API_ADV_ADDRESS}"
node.vm.provision "shell", path: "pod-setup.sh"
end
Expand All @@ -28,7 +28,7 @@ Vagrant.configure("2") do |config|
vb.memory = 1024
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/worker.sh", args: "#{i}"
end
end
Expand Down
4 changes: 2 additions & 2 deletions app-a/ch04/close-ports/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
vb.memory = 2048
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/control-plane.sh", args: "#{POD_CIDR} #{API_ADV_ADDRESS}"
end

Expand All @@ -27,7 +27,7 @@ Vagrant.configure("2") do |config|
vb.memory = 1024
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/worker.sh", args: "#{i}"
node.vm.provision "shell", path: "service-setup.sh"
end
Expand Down
4 changes: 2 additions & 2 deletions app-a/ch04/seccomp/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
vb.memory = 2048
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/control-plane.sh", args: "#{POD_CIDR} #{API_ADV_ADDRESS}"
node.vm.provision "shell", path: "pod-setup.sh"
end
Expand All @@ -28,7 +28,7 @@ Vagrant.configure("2") do |config|
vb.memory = 1024
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/worker.sh", args: "#{i}"
end
end
Expand Down
4 changes: 2 additions & 2 deletions app-a/ch05/gvisor/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
vb.memory = 2048
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/control-plane.sh", args: "#{POD_CIDR} #{API_ADV_ADDRESS}"
end

Expand All @@ -27,7 +27,7 @@ Vagrant.configure("2") do |config|
vb.memory = 1024
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/worker.sh", args: "#{i}"
node.vm.provision "shell", path: "runsc.sh", args: "#{i}"
end
Expand Down
4 changes: 2 additions & 2 deletions app-a/ch07/audit-log/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
vb.memory = 2048
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/control-plane.sh", args: "#{POD_CIDR} #{API_ADV_ADDRESS}"
node.vm.provision "shell", path: "audit-policy-setup.sh"
end
Expand All @@ -28,7 +28,7 @@ Vagrant.configure("2") do |config|
vb.memory = 1024
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/worker.sh", args: "#{i}"
end
end
Expand Down
4 changes: 2 additions & 2 deletions app-a/ch07/falco/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Vagrant.configure("2") do |config|
vb.memory = 2048
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/control-plane.sh", args: "#{POD_CIDR} #{API_ADV_ADDRESS}"
node.vm.provision "shell", path: "pod-setup.sh"
end
Expand All @@ -28,7 +28,7 @@ Vagrant.configure("2") do |config|
vb.memory = 1024
vb.cpus = 2
end
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-00"}
node.vm.provision "shell", path: "../../vagrant-scripts/common.sh", env: {"K8S_VERSION" => "1.26.1-1.1"}
node.vm.provision "shell", path: "../../vagrant-scripts/worker.sh", args: "#{i}"
node.vm.provision "shell", path: "falco-install.sh"
end
Expand Down
6 changes: 3 additions & 3 deletions app-a/vagrant-scripts/common.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

if [ -z ${K8S_VERSION+x} ]; then
K8S_VERSION=1.26.1-00
K8S_VERSION=1.26.1-1.1
fi

# Install containerd container runtime
Expand Down Expand Up @@ -30,8 +30,8 @@ sudo systemctl restart containerd

sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo curl -fsSL "https://pkgs.k8s.io/core:/stable:/v${K8S_VERSION:0:4}/deb/Release.key" | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${K8S_VERSION:0:4}/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list

# Install Kubernetes binaries
sudo apt-get update
Expand Down
4 changes: 4 additions & 0 deletions app-a/vagrant-scripts/control-plane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ API_ADV_ADDRESS=$2

kubeadm init --pod-network-cidr $POD_CIDR --apiserver-advertise-address $API_ADV_ADDRESS | tee /vagrant/kubeadm-init.out

# deb packages for kubelet on pkgs.k8s.io seem to include a systemd service definition for redhat machines #3276
# apply same sed fix as in https://github.com/kubernetes/release/pull/3279
sed -i 's;/etc/sysconfig/kubelet;/etc/default/kubelet;g' /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
systemctl daemon-reload
echo "KUBELET_EXTRA_ARGS=--node-ip=$API_ADV_ADDRESS --cgroup-driver=systemd" > /etc/default/kubelet
systemctl restart kubelet

Expand Down
4 changes: 4 additions & 0 deletions app-a/vagrant-scripts/worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ NODE_HOST_IP="192.168.56.$((20+$NODE))"

$(cat /vagrant/kubeadm-init.out | grep -A 2 "kubeadm join" | sed -e 's/^[ \t]*//' | tr '\n' ' ' | sed -e 's/ \\ / /g')

# deb packages for kubelet on pkgs.k8s.io seem to include a systemd service definition for redhat machines #3276
# apply same sed fix as in https://github.com/kubernetes/release/pull/3279
sed -i 's;/etc/sysconfig/kubelet;/etc/default/kubelet;g' /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
systemctl daemon-reload
echo "KUBELET_EXTRA_ARGS=--node-ip=$NODE_HOST_IP --cgroup-driver=systemd" > /etc/default/kubelet
systemctl restart kubelet

Expand Down