-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkthw.tf
139 lines (101 loc) · 4.11 KB
/
kthw.tf
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
module "vnet" {
source = "modules/vnet"
location = "${var.location}"
vnet_name = "kthw"
vnet_address_space = ["10.240.0.0/24"]
}
module "lb_masters" {
source = "modules/lb"
resource_group_name = "${module.vnet.resource_group_name}"
location = "${var.location}"
lb_name = "lb_masters"
}
module "master_ssh_inbound" {
source = "modules/lb_rule"
resource_group_name = "${module.vnet.resource_group_name}"
loadbalancer_id = "${module.lb_masters.lb_id}"
name = "ssh"
protocol = "Tcp"
frontend_port = 22
backend_port = 22
frontend_ip_configuration = "${module.lb_masters.frontend_ip_config}"
backend_ip_address_pool = "${module.lb_masters.lb_backend_pool}"
}
module "lb_workers" {
source = "modules/lb"
resource_group_name = "${module.vnet.resource_group_name}"
location = "${var.location}"
lb_name = "lb_workers"
}
module "masters" {
source = "modules/vms"
vm_prefix = "kthw-master"
vm_count = "${var.master_count}"
vm_size = "Standard_D1_v2"
subnet_id = "${module.vnet.subnet_id}"
resource_group_name = "${module.vnet.resource_group_name}"
location = "${var.location}"
private_ip_addresses = "${var.master_ip_addresses}"
lb_backend_pool = "${module.lb_masters.lb_backend_pool}"
username = "${var.node_user}"
ssh_key = "${var.node_ssh_key}"
public_ip = "${module.lb_masters.public_ip_address}"
consul_agent_type = "server"
}
module "workers" {
source = "modules/vms"
vm_prefix = "kthw-worker"
vm_count = "${var.worker_count}"
vm_size = "Standard_D1_v2"
subnet_id = "${module.vnet.subnet_id}"
resource_group_name = "${module.vnet.resource_group_name}"
location = "${var.location}"
private_ip_addresses = "${var.worker_ip_addresses}"
lb_backend_pool = "${module.lb_workers.lb_backend_pool}"
username = "${var.node_user}"
ssh_key = "${var.node_ssh_key}"
public_ip = "${module.lb_masters.public_ip_address}"
}
module "pki" {
source = "modules/pki"
kubelet_node_names = "${module.workers.names}"
apiserver_node_names = "${module.masters.names}"
kubelet_node_ips = "${module.workers.private_ip_addresses}"
apiserver_master_ips = "${module.masters.private_ip_addresses}"
apiserver_public_ip = "${module.lb_masters.public_ip_address}"
node_user = "${var.node_user}"
}
module "kubeconfig" {
source = "modules/kubeconfig"
kubelet_node_names = "${module.workers.names}"
apiserver_node_names = "${module.masters.names}"
kubelet_count = "${var.worker_count}"
apiserver_public_ip = "${module.lb_masters.public_ip_address}"
node_user = "${var.node_user}"
kubelet_crt_pems = "${module.pki.kubelet_crt_pems}"
kubelet_key_pems = "${module.pki.kubelet_key_pems}"
kube-proxy_crt_pem = "${module.pki.kube-proxy_crt_pem}"
kube-proxy_key_pem = "${module.pki.kube-proxy_key_pem}"
admin_crt_pem = "${module.pki.admin_crt_pem}"
admin_key_pem = "${module.pki.admin_key_pem}"
kube-scheduler_crt_pem = "${module.pki.kube-scheduler_crt_pem}"
kube-scheduler_key_pem = "${module.pki.kube-scheduler_key_pem}"
kube-controller-manager_crt_pem = "${module.pki.kube-controller-manager_crt_pem}"
kube-controller-manager_key_pem = "${module.pki.kube-controller-manager_key_pem}"
kube_ca_crt_pem = "${module.pki.kube_ca_crt_pem}"
}
module "encryption_config" {
source = "modules/encryption_config"
apiserver_node_names = "${module.masters.names}"
apiserver_public_ip = "${module.lb_masters.public_ip_address}"
node_user = "${var.node_user}"
}
module "etcd" {
source = "modules/etcd"
apiserver_node_names = "${module.masters.names}"
apiserver_public_ip = "${module.lb_masters.public_ip_address}"
apiserver_private_ips = "${var.master_ip_addresses}"
node_user = "${var.node_user}"
kubernetes_certs_null_ids = "${module.pki.kubernetes_certs_null_ids}"
ca_cert_null_ids = "${module.pki.ca_cert_null_ids}"
}