-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-k3s_cluster.yml
64 lines (58 loc) · 3.03 KB
/
deploy-k3s_cluster.yml
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
---
- hosts: all
gather_facts: yes
order: inventory
any_errors_fatal: no
ignore_unreachable: no
# Install K3S server
- name: Install K3S server
hosts: k3s_server
gather_facts: no
order: inventory
serial: 1
any_errors_fatal: no
ignore_unreachable: no
become: yes
vars:
iptables_additional_rules:
- "61-filter_k3s_server": |
-A INPUT -p tcp -m tcp --dport 6443 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Kubernetes API server" -j ACCEPT
-A INPUT -p tcp -m tcp --dport 2379:2380 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "etcd server client API" -j ACCEPT
-A INPUT -p tcp -m tcp --dport 10250 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "kubelet metrics" -j ACCEPT
-A INPUT -p udp -m udp --dport 8472 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Flannel networking (VXLAN)" -j ACCEPT
# -A INPUT -p tcp -m tcp --dport 179 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Calico networking (BGP)" -j ACCEPT
# -A INPUT -p udp -m udp --dport 8472 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Calico networking with VXLAN" -j ACCEPT
- "62-filter_k3s_common": |
-A INPUT -p tcp -m tcp --dport 9100 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Prometheus node exporter" -j ACCEPT
- "91-logging_k3s_ignore": |
-A LOGGING -p tcp --dport 2380 --tcp-flags RST RST -j DROP
-A LOGGING -p tcp --dport 6443 --tcp-flags RST RST -j DROP
k3s_node_taints:
- { name: node-role.kubernetes.io/master, value: "true", effect: "NoSchedule" }
roles:
- { role: iptables }
- { role: k3s }
# Install K3S agent
- name: Install K3S agent
hosts: k3s_agent
gather_facts: no
order: inventory
any_errors_fatal: no
ignore_unreachable: no
become: yes
vars:
iptables_additional_rules:
- "61-filter_k3s_agent": |
-A INPUT -p tcp -m tcp --dport 10250 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "kubelet metrics" -j ACCEPT
-A INPUT -p udp -m udp --dport 8472 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Flannel networking (VXLAN)" -j ACCEPT
# -A INPUT -p tcp -m tcp --dport 179 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Calico networking (BGP)" -j ACCEPT
# -A INPUT -p udp -m udp --dport 8472 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Calico networking with VXLAN" -j ACCEPT
- "62-filter_k3s_common": |
-A INPUT -p tcp -m tcp --dport 7946 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "MetalLB memberlist" -j ACCEPT
-A INPUT -p udp -m udp --dport 7946 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "MetalLB memberlist" -j ACCEPT
-A INPUT -p tcp -m tcp --dport 9100 -m conntrack --ctstate NEW,UNTRACKED -m comment --comment "Prometheus node exporter" -j ACCEPT
k3s_node_labels:
- { name: node-role.kubernetes.io/worker, value: "true" }
roles:
- { role: iptables }
- { role: k3s }