aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/k8s/tasks/ufw.yml
blob: c4c653adff286dbbccb1d42b13d9ed86e14ef1de (plain)
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
---
- name: Ensure UFW is installed
  ansible.builtin.apt:
    name: ufw
    state: present

- name: Allow Kubernetes API server (6443)
  community.general.ufw:
    rule: allow
    port: 6443
    proto: tcp
    comment: "Kubernetes API server"

- name: Allow etcd server client API (2379-2380)
  community.general.ufw:
    rule: allow
    port: "2379:2380"
    proto: tcp
    comment: "etcd server client API"

- name: Allow Kubelet API (10250)
  community.general.ufw:
    rule: allow
    port: 10250
    proto: tcp
    comment: "Kubelet API"

- name: Allow kube-scheduler (10259)
  community.general.ufw:
    rule: allow
    port: 10259
    proto: tcp
    comment: "kube-scheduler"

- name: Allow kube-controller-manager (10257)
  community.general.ufw:
    rule: allow
    port: 10257
    proto: tcp
    comment: "kube-controller-manager"

- name: Allow kube-proxy (10256)
  community.general.ufw:
    rule: allow
    port: 10256
    proto: tcp
    comment: "kube-proxy"

- name: Allow NodePort services (30000-32767)
  community.general.ufw:
    rule: allow
    port: "30000:32767"
    proto: tcp
    comment: "NodePort services"

- name: Enable UFW
  community.general.ufw:
    state: enabled

- name: Ensure UFW is enabled on boot
  ansible.builtin.systemd:
    name: ufw
    enabled: true
...