-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathexample.tf
314 lines (272 loc) · 8.99 KB
/
example.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# This example same as https://github.com/rancher/rke/blob/master/cluster.yml
resource rke_cluster "cluster" {
# Disable port check validation between nodes
disable_port_check = false
###############################################
# Kubernets nodes
###############################################
nodes = [
{
address = "1.1.1.1"
user = "ubuntu"
role = ["controlplane", "etcd"]
ssh_key_path = "~/.ssh/id_rsa"
port = 2222
},
{
address = "2.2.2.2"
user = "ubuntu"
role = ["worker"]
ssh_key = <<EOL
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
EOL
# or
#ssh_key = "${file("~/.ssh/id_rsa")}"
},
{
address = "example.com"
user = "ubuntu"
role = ["role"]
hostname_override = "node3"
internal_address = "192.168.1.6"
labels = {
app = "ingress"
}
},
]
###############################################
# Kubernetes services
###############################################
services_etcd {
# if external etcd used
#path = "/etcdcluster"
#ca_cert = "${file("ca_cert")}"
#cert = "${file("cert")}"
#key = "${file("key")}"
}
services_kube_api {
service_cluster_ip_range = "10.42.0.0/1"
pod_security_policy = false
# add additional arguments to the kubernetes component
# Note that this WILL OVERRIDE existing defaults
extra_args = {
v = 4
}
}
services_kube_controller {
cluster_cidr = "10.42.0.0/16"
service_cluster_ip_range = "10.43.0.0/16"
}
services_scheduler {}
services_kubelet {
cluster_domain = "cluster.local"
cluster_dns_server = "10.43.0.10"
infra_container_image = "gcr.io/google_containers/pause-amd64:3.0"
# Optionally define additional volume binds to a service
extra_binds = [
"/host/dev:/dev",
"usr/libexec/kubernetes/kubelet-plugins:/usr/libexec/kubernetes/kubelet-plugins",
]
}
services_kubeproxy {}
#########################################################
# Network(CNI) - supported: flannel/calico/canal/weave
#########################################################
# default: flannel
network {
plugin = "flannel"
options = {
# To specify flannel interface, you can use the 'flannel_iface' option: # flannel_iface = "eth1"
}
}
# If you are using calico on AWS or GCE, use the network plugin config option:
# 'calico_cloud_provider: aws'
#network {
# plugin = "calico"
# options = {
# calico_cloud_provider = "aws"
# }
#}
# To specify flannel interface for canal plugin, you can use the 'canal_iface' option:
#network {
# plugin = "canal"
# options = {
# canal_iface = "eth1"
# }
#}
################################################
# Authentication
################################################
# At the moment, the only authentication strategy supported is x509.
# You can optionally create additional SANs (hostnames or IPs) to add to
# the API server PKI certificate. This is useful if you want to use a load balancer
# for the control plane servers, for example.
authentication {
strategy = "x509"
sans = [
"10.18.160.10",
"my-loadbalancer-1234567890.us-west-2.elb.amazonaws.com",
]
}
################################################
# Addons
################################################
# all addon manifests MUST specify a namespace
addons = <<EOL
---
apiVersion: v1
kind: Pod
metadata:
name: my-nginx
namespace: default
spec:
containers:
- name: my-nginx
image: nginx
ports:
- containerPort: 80
EOL
addons_include = [
"https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/rook-operator.yaml",
"https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/rook-cluster.yaml",
"/path/to/manifest",
]
################################################
# System Images
################################################
system_images {
etcd = "rancher/etcd:v3.0.17"
kubernetes = "rancher/hyperkube:v1.10.1"
alpine = "rancher/rke-tools:v0.1.4"
nginx_proxy = "rancher/rke-tools:v0.1.4"
cert_downloader = "rancher/rke-tools:v0.1.4"
kubernetes_services_sidecar = "rancher/rke-tools:v0.1.4"
kube_dns = "rancher/k8s-dns-kube-dns-amd64:1.14.5"
dnsmasq = "rancher/k8s-dns-dnsmasq-nanny-amd64:1.14.5"
kube_dns_sidecar = "rancher/k8s-dns-sidecar-amd64:1.14.5"
kube_dns_autoscaler = "rancher/cluster-proportional-autoscaler-amd64:1.0.0"
# for CNI
flannel = "rancher/coreos-flannel:v0.9.1"
flannel_cni = "rancher/coreos-flannel-cni:v0.2.0"
#calico_node = ""
#calico_cni = ""
#calico_controllers = ""
#calico_ctl = ""
#canal_node = ""
#canal_cni = ""
#canal_flannel = ""
#weave_node = ""
#weave_cni = ""
# pod_infra_container = ""
# ingress = ""
# ingress_backend = ""
# dashboard = ""
# heapster = ""
# grafana = ""
# influxdb = ""
# tiller = ""
}
################################################
# SSH configuration
################################################
ssh_key_path = "~/.ssh/test"
ssh_agent_auth = false
################################################
# Authorization
################################################
# Kubernetes authorization mode
# - Use `mode: rbac` to enable RBAC
# - Use `mode: none` to disable authorization
authorization {
mode = "rbac"
}
################################################
# Versions
################################################
#Enable/Disable strict docker version checking
ignore_docker_version = false //
# Kubernetes version to use
# (if kubernetes image is specifed, image version takes precedence)
kubernetes_version = "v1.10.1"
################################################
# Private Registries
################################################
# List of registry credentials, if you are using a Docker Hub registry,
# you can omit the `url` or set it to `docker.io`
private_registries = {
url = "registry1.com"
user = "Username"
password = "password1"
}
private_registries = {
url = "registry2.com"
user = "Username"
password = "password1"
}
################################################
# Ingress
################################################
# Currently only nginx ingress provider is supported.
# To disable ingress controller, set `provider: none`
ingress {
provider = "nginx"
# To enable ingress on specific nodes, use the node_selector, eg:
#node_selector = {
# app = "ingress"
#}
#extra_args = {
# enable-ssl-passthrough = ""
#}
}
################################################
# Cluster Name
################################################
# Cluster Name used in the kube config
#cluster_name = ""
################################################
# Cloud Provider
################################################
cloud_provider {
name = "aws"
# for Azure
#name = "azure"
#cloud_config = {
# aadClientId = "xxxxxxxxxxxx"
# aadClientSecret = "xxxxxxxxxxx"
# location = "westus"
# resourceGroup = "rke-rg"
# subnetName = "rke-subnet"
# subscriptionId = "xxxxxxxxxxx"
# vnetName = "rke-vnet"
# tenantId = "xxxxxxxxxx"
# securityGroupName = "rke-nsg"
#}
}
# Kubernetes directory path
# prefix_path = "/"
}
###############################################################################
# If you need kubeconfig.yml for using kubectl, please uncomment follows.
###############################################################################
#resource "local_file" "kube_cluster_yaml" {
# filename = "${path.root}/kube_config_cluster.yml"
# content = "${rke_cluster.cluster.kube_config_yaml}"
#}
###############################################################################
# If you ca_crt/client_cert/client_key, please uncomment follows.
###############################################################################
#resource "local_file" "ca_crt" {
# filename = "${path.root}/ca_cert"
# content = "${rke_cluster.cluster.ca_crt}"
#}
#
#resource "local_file" "client_cert" {
# filename = "${path.root}/client_cert"
# content = "${rke_cluster.cluster.client_cert}"
#}
#
#resource "local_file" "client_key" {
# filename = "${path.root}/client_key"
# content = "${rke_cluster.cluster.client_key}"
#}