-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud-config
50 lines (45 loc) · 1.84 KB
/
cloud-config
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
#cloud-config
package_update: true
package_upgrade: true
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
- gpg
write_files:
# make sure that required modules are loaded at system startup
- path: /etc/modules-load.d/kubernetes.conf
content: |
overlay
br_netfilter
# make sure that required network settings are loaded at system startup
- path: /etc/sysctl.d/kubernetes.conf
content: |
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
# info: https://github.com/hetznercloud/hcloud-cloud-controller-manager
- path: /etc/default/kubelet
content: |
KUBELET_EXTRA_ARGS="--cloud-provider=external"
runcmd:
# Load modules without reboot
- modprobe overlay
- modprobe br_netfilter
# Load network settings without reboot
- sysctl --system
# Add the Kubernetes repository v1.31
- curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.31/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:/v1.31/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
# Add the CRI-O repository v1.31
- curl -fsSL https://pkgs.k8s.io/addons:/cri-o:/stable:/v1.31/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:/stable:/v1.31/deb/ /" | tee /etc/apt/sources.list.d/cri-o.list
# Update index & install
- apt update -y
- apt install -y kubeadm cri-o kubelet kubectl
- apt-mark hold kubelet kubeadm kubectl cri-o
# Start the service
- systemctl start --no-block crio.service
- systemctl enable --now kubelet # It will crashloop waiting for kubeadm