-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathVagrantfile-ubuntu
79 lines (64 loc) · 2.6 KB
/
Vagrantfile-ubuntu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/ubuntu2204"
memory = 8192
cpus = 4
config.vm.provider :virtualbox do |v|
v.memory = memory
v.cpus = cpus
end
config.vm.provider :libvirt do |v|
v.memory = memory
v.cpus = cpus
end
if File.exist?("./ssh-config")
config.ssh.config = "./ssh-config"
end
config.vm.synced_folder ".", "/vagrant"
config.vm.provision "install-dependencies", type: "shell", run: "once" do |sh|
sh.inline = <<~SHELL
set -euxo pipefail
# Use a non-localhost DNS to avoid cluster DNS lookup loops
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# Install Go
GO_VERSION=$(curl -sSfL "https://go.dev/VERSION?m=text" | head -n1)
curl -sSfL -o- https://go.dev/dl/$GO_VERSION.linux-amd64.tar.gz |
tar xfz - -C /usr/local
# Kubernetes
KUBERNETES_VERSION=v1.32
curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBERNETES_VERSION/deb/Release.key | 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:/$KUBERNETES_VERSION/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/cri-o-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/cri-o-apt-keyring.gpg] https://pkgs.k8s.io/addons:/cri-o:/prerelease:/main/deb/ /" | tee /etc/apt/sources.list.d/cri-o.list
apt-get update
apt-get install -y \
build-essential \
cri-o \
kubelet \
kubeadm \
kubectl \
podman \
jq \
moreutils \
apparmor \
apparmor-utils
# Load the prebuilt container image
podman load -i /vagrant/image.tar
# Baseprofile recording requires cosign
COSIGN_VERSION=v2.4.1
COSIGN_BINARY=/usr/bin/cosign
curl -sSfL --retry 5 --retry-delay 3 "https://github.com/sigstore/cosign/releases/download/$COSIGN_VERSION/cosign-linux-amd64" -o "$COSIGN_BINARY"
chmod +x "$COSIGN_BINARY"
# Setup CNI to disable IPv6
CNI_CONFIG=/etc/cni/net.d/10-crio-bridge.conflist
jq 'del(.plugins[0].ipam.routes[1], .plugins[0].ipam.ranges[1])' $CNI_CONFIG.disabled >$CNI_CONFIG
# Setup CRI-O
systemctl enable --now crio
# Disable kernel print rate limiting for syslog messaging
sysctl -w kernel.printk_ratelimit=0
sysctl -w kernel.printk_ratelimit_burst=0
/vagrant/hack/ci/install-kubernetes.sh
SHELL
end
end