Skip to content

Commit 477b7b3

Browse files
committed
Clean up security group rules
This PR does not fix anything broken but simply cleans up the security group rules and the cluster internal etcd communication. * make sure legacy etcd ports are not used * remove legacy etcd ports * remove obsolete internal 443 rule * order rules by port ascending, private rules first
1 parent 82c8715 commit 477b7b3

File tree

3 files changed

+18
-41
lines changed

3 files changed

+18
-41
lines changed

roles/k8s/tasks/create_secgroup_rules.yml

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,29 @@
1010

1111
# Rules for the k8s security group
1212

13-
- name: SSH for k8s
14-
local_action:
15-
module: cs_securitygroup_rule
16-
security_group: "{{ k8s_security_group_name }}"
17-
start_port: 22
18-
end_port: 22
19-
20-
#etcd
21-
- name: etcd 4001
22-
local_action:
23-
module: cs_securitygroup_rule
24-
security_group: "{{ k8s_security_group_name }}"
25-
start_port: 4001
26-
end_port: 4001
27-
user_security_group: "{{ k8s_security_group_name }}"
28-
29-
- name: etcd 7001
30-
local_action:
31-
module: cs_securitygroup_rule
32-
security_group: "{{ k8s_security_group_name }}"
33-
start_port: 7001
34-
end_port: 7001
35-
user_security_group: "{{ k8s_security_group_name }}"
36-
37-
- name: etcd 2379
13+
# internal
14+
- name: flannel etcd 2379
3815
local_action:
3916
module: cs_securitygroup_rule
4017
security_group: "{{ k8s_security_group_name }}"
41-
start_port: 7001
42-
end_port: 7001
18+
start_port: 2379
19+
end_port: 2379
4320
user_security_group: "{{ k8s_security_group_name }}"
4421

45-
- name: etcd 2380
22+
- name: flannel etcd 2380
4623
local_action:
4724
module: cs_securitygroup_rule
4825
security_group: "{{ k8s_security_group_name }}"
4926
start_port: 2380
5027
end_port: 2380
5128
user_security_group: "{{ k8s_security_group_name }}"
5229

53-
- name: k8s secure
30+
- name: k8s 8080
5431
local_action:
5532
module: cs_securitygroup_rule
5633
security_group: "{{ k8s_security_group_name }}"
57-
start_port: 443
58-
end_port: 443
34+
start_port: 8080
35+
end_port: 8080
5936
user_security_group: "{{ k8s_security_group_name }}"
6037

6138
- name: flannel UDP 8472
@@ -76,14 +53,14 @@
7653
protocol: tcp
7754
user_security_group: "{{ k8s_security_group_name }}"
7855

79-
#k8s api
80-
- name: k8s 8080
56+
# external access
57+
58+
- name: SSH for k8s
8159
local_action:
8260
module: cs_securitygroup_rule
8361
security_group: "{{ k8s_security_group_name }}"
84-
start_port: 8080
85-
end_port: 8080
86-
user_security_group: "{{ k8s_security_group_name }}"
62+
start_port: 22
63+
end_port: 22
8764

8865
- name: k8s public secure
8966
local_action:

roles/k8s/templates/k8s-master.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ coreos:
6262

6363
etcd2:
6464
name: master
65-
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
66-
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
65+
listen-client-urls: http://0.0.0.0:2379
66+
advertise-client-urls: http://$private_ipv4:2379
6767
initial-cluster-token: k8s_etcd
68-
listen-peer-urls: http://$private_ipv4:2380,http://$private_ipv4:7001
68+
listen-peer-urls: http://$private_ipv4:2380
6969
initial-advertise-peer-urls: http://$private_ipv4:2380
7070
initial-cluster: master=http://$private_ipv4:2380
7171
initial-cluster-state: new

roles/k8s/templates/k8s-node.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ write-files:
1111
exit $?
1212
coreos:
1313
etcd2:
14-
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
15-
advertise-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
14+
listen-client-urls: http://0.0.0.0:2379
15+
advertise-client-urls: http://0.0.0.0:2379
1616
initial-cluster: master=http://{{ k8s_master.default_ip }}:2380
1717
proxy: on
1818
fleet:

0 commit comments

Comments
 (0)