-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathk3s-internal.yaml
More file actions
107 lines (92 loc) · 2.69 KB
/
Copy pathk3s-internal.yaml
File metadata and controls
107 lines (92 loc) · 2.69 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
# Butane Config for Flatcar Container Linux with K3s
# K3s server in private network with custom routing
variant: flatcar
version: 1.0.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-rsa AAAAB3... user@example.com # Replace with your SSH public key
storage:
files:
- path: /etc/hostname
mode: 0644
contents:
source: http://169.254.169.254/hetzner/v1/metadata/hostname
- path: /etc/rancher/k3s/config.yaml
mode: 0644
contents:
inline: |
write-kubeconfig-mode: "0644"
# Bind to private network interface
bind-address: 192.168.240.2
advertise-address: 192.168.240.2
# Optional: Disable built-in components
# disable:
# - traefik
# - servicelb
# Custom network configuration for private network
networkd:
units:
- name: 10-private-network.network
contents: |
[Match]
Name=eth0
[Network]
DHCP=yes
DNS=1.1.1.1
DNS=1.0.0.1
[Route]
Gateway=192.168.240.1
Destination=0.0.0.0/0
systemd:
units:
# Disable Docker and Containerd (K3s brings its own)
- name: containerd.service
enabled: false
- name: docker.service
enabled: false
# Install K3s on first boot
- name: k3s-install.service
enabled: true
contents: |
[Unit]
Description=Run initial K3s installation
Wants=network-online.target
After=network.target network-online.target
ConditionFirstBoot=yes
[Service]
Type=oneshot
TimeoutStartSec=300
Environment="INSTALL_K3S_CHANNEL=stable"
Environment="INSTALL_K3S_EXEC=server"
# For cluster mode in private network:
# Environment="K3S_TOKEN=your-secret-token"
# Environment="INSTALL_K3S_EXEC=server --cluster-init --flannel-iface=eth0"
ExecStart=/bin/sh -c "curl -sfL https://get.k3s.io | sh -"
[Install]
WantedBy=first-boot-complete.target
# Daily K3s updates
- name: k3s-updater.service
contents: |
[Unit]
Description=Run K3s Update
Wants=network-online.target
After=network.target network-online.target
[Service]
Type=oneshot
TimeoutStartSec=300
Environment="INSTALL_K3S_CHANNEL=stable"
Environment="INSTALL_K3S_SKIP_SELINUX_RPM=true"
ExecStart=/bin/sh -c "curl -sfL https://get.k3s.io | sh -"
- name: k3s-updater.timer
enabled: true
contents: |
[Unit]
Description=Run k3s-updater daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target