You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- support to create a new vpc and improve this module [GH-3](https://github.com/terraform-alicloud-modules/terraform-alicloud-managed-kubernetes/pull/3)
@@ -22,69 +23,126 @@ This example can specify the following arguments to create user-defined kubernte
22
23
* region: The ID of region in which launching resources
23
24
* k8s_name_prefix: The name prefix of kubernetes cluster
24
25
* worker_number: The number of worker nodes in each kubernetes cluster
25
-
* k8s_pod_cidr: The kubernetes pod cidr block. It cannot be equals to vpc's or vswitch's and cannot be in them. If vpc's cidr block is `172.16.XX.XX/XX`,
26
-
it had better to `192.168.XX.XX/XX` or `10.XX.XX.XX/XX`
26
+
* k8s_pod_cidr: The kubernetes pod cidr block. It cannot be equals to vpc's or vswitch's and cannot be in them.
27
27
* k8s_service_cidr: The kubernetes service cidr block. Its setting rule is same as `k8s_pod_cidr`
28
28
* Other kubernetes cluster arguments
29
29
30
-
**Note:** In order to avoid some needless error, you had better to set `new_nat_gateway` to `true`.
31
-
Otherwise, you must you must ensure you specified vswitches can access internet before running the example.
32
-
33
-
Planning phase
34
-
35
-
terraform plan
36
-
37
-
Apply phase
38
-
39
-
terraform apply
40
-
41
-
42
-
Destroy
43
-
44
-
terraform destroy
45
-
46
-
47
-
Conditional creation
48
-
--------------------
49
-
This example can support the following creating kubernetes cluster scenario by setting different arguments.
50
-
51
-
### 1. Create a new vpc, vswitches and nat gateway for the cluster.
52
-
53
-
You can specify the following user-defined arguments:
54
-
55
-
* vpc_name: A new vpc name
56
-
* vpc_cidr: A new vpc cidr block
57
-
* vswitch_name_prefix: The name prefix of several vswitches
58
-
* vswitch_cidrs: List of cidr blocks for several new vswitches
59
-
60
-
### 2. Using existing vpc and vswitches for the cluster.
61
-
62
-
You can specify the following user-defined arguments:
63
-
64
-
* vpc_id: A existing vpc ID
65
-
* vswitch_ids: List of IDs for several existing vswitches
66
-
67
-
### 3. Using existing vpc, vswitches and nat gateway for the cluster.
68
-
69
-
You can specify the following user-defined arguments:
70
-
71
-
* vpc_id: A existing vpc ID
72
-
* vswitch_ids: List of IDs for several existing vswitches
73
-
* new_nat_gateway: Set it to false. But you must ensure you specified vswitches can access internet.
74
-
In other words, you must set snat entry for each vswitch before running the example.
30
+
Usage
31
+
-----
75
32
33
+
This module used to create a managed kubernetes and it can meet several scenarios by specifying different parameters.
34
+
35
+
1. Create a new vpc, several new vswitches and a new nat gateway for the cluster.
36
+
```hcl
37
+
// Create a scaling group using autoscaling module at first.
In this scenario, if setting `new_nat_gateway=false`, you should ensure the specified vswitches can access internet.
75
+
In other words, the specified vpc has a nat gateway and there are several snat entries to bind the vswitches and a EIP.
76
+
77
+
**NOTE:** This module using AccessKey and SecretKey are from `profile` and `shared_credentials_file`.
78
+
If you have not set them yet, please install [aliyun-cli](https://github.com/aliyun/aliyun-cli#installation) and configure it.
79
+
80
+
## Conditional creation
81
+
82
+
This moudle can set [sls project](https://www.terraform.io/docs/providers/alicloud/r/log_project.html) config for this module
83
+
84
+
1. Create a new sls project with `new_sls_project`:
85
+
```hcl
86
+
new_sls_project = true
87
+
```
88
+
89
+
1. Using existing sls project with `sls_project_name`:
90
+
```hcl
91
+
sls_project_name = "Your-sls-project-name"
92
+
```
93
+
94
+
## Inputs
95
+
96
+
| Name | Description | Type | Default | Required |
97
+
|------|-------------|:----:|:-----:|:-----:|
98
+
| region | The region ID used to launch this module resources. If not set, it will be sourced from followed by ALICLOUD_REGION environment variable and profile | string | '' | no |
99
+
| profile | The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable. | string | '' | no |
100
+
| shared_credentials_file | This is the path to the shared credentials file. If this is not set and a profile is specified, $HOME/.aliyun/config.json will be used. | string | '' | no |
101
+
| skip_region_validation | Skip static validation of region ID. Used by users of alternative AlibabaCloud-like APIs or users w/ access to regions that are not public (yet). | bool | false | no |
102
+
| new_vpc | Create a new vpc for this module | string | false | no |
103
+
| vpc_cidr | The cidr block used to launch a new vpc | string | "192.168.0.0/16" | no |
104
+
| vswitch_ids | List Ids of existing vswitch | string | [] | yes |
105
+
| vswitch_cidrs | List cidr blocks used to create several new vswitches when 'new_vpc' is true | string | ["192.168.1.0/24"] | yes |
106
+
| availability_zones | List available zone ids used to create several new vswitches when 'vswitch_ids' is not specified. If not set, data source `alicloud_zones` will return one automatically. | list | [] | no |
107
+
| new_eip_bandwidth | The bandwidth used to create a new EIP when 'new_vpc' is true | int | 50 | no |
108
+
| new_nat_gateway | Seting it to true can create a new nat gateway automatically in a existing VPC. If 'new_vpc' is true, it will be ignored | bool | false|
109
+
| cpu_core_count | CPU core count is used to fetch instance types | int | 1 | no |
110
+
| memory_size | Memory size used to fetch instance types | int | 2 | no |
111
+
| worker_instance_types | The ecs instance type used to launch worker nodes. If not set, data source `alicloud_instance_types` will return one based on `cpu_core_count` and `memory_size` | list | ["ecs.n4.xlarge"] | no |
112
+
| worker_disk_category | The system disk category used to launch one or more worker nodes| string | "cloud_efficiency" | no |
113
+
| worker_disk_size | The system disk size used to launch one or more worker nodes| int | 40 |no |
114
+
| ecs_password | The password of work nodes | string | "Abc12345" | no |
115
+
| worker_number | The number of kubernetes cluster work nodes | int | 2 | no |
116
+
| k8s_name_prefix | The name prefix used to create managed kubernetes cluster | string | "terraform-alicloud-managed-kubernetes" | no |
117
+
| k8s_pod_cidr | The kubernetes pod cidr block. It cannot be equals to vpc's or vswitch's and cannot be in them. If vpc's cidr block is `172.16.XX.XX/XX`, it had better to `192.168.XX.XX/XX` or `10.XX.XX.XX/XX` | string | "172.20.0.0/16" | no |
118
+
| k8s_service_cidr | The kubernetes service cidr block. It cannot be equals to vpc's or vswitch's or pod's and cannot be in them. Its setting rule is same as `k8s_pod_cidr` | string | "172.21.0.0/20" | no |
119
+
| cluster_network_type | Network type, valid options are `flannel` and `terway` | string | "flannel" | no |
120
+
| new_sls_project | Create a new sls project for this module | bool | false | no |
121
+
| sls_project_name | Specify a existing sls project for this module | string | "" | no |
122
+
123
+
## Outputs
124
+
125
+
| Name | Description |
126
+
|------|-------------|
127
+
| this_k8s_id | The ID of managed kubernetes cluster |
128
+
| this_k8s_name | The name of managed kubernetes cluster |
129
+
| this_k8s_nodes | List worker nodes of managed kubernetes cluster |
130
+
| this_vpc_id | The ID of VPC |
131
+
| this_vswitch_ids | List Ids of vswitches |
132
+
| this_security_group_id | ID of the Security Group used to deploy kubernetes cluster |
133
+
| this_sls_project_name | The sls project name used to configure cluster |
76
134
77
135
Terraform version
78
136
-----------------
79
-
Terraform version 0.11.0 or newer and Provider version 1.57.2 or newer are required for this example to work.
137
+
Terraform version 0.12.0 or newer and Provider version 1.57.2 or newer are required for this example to work.
80
138
81
139
Authors
82
140
-------
83
-
Created and maintained by Meng Xiaobing(@menglingwei, menglingwei@gmail.com)
141
+
Created and maintained by Meng Xiaobing(@menglingwei, menglingwei@gmail.com, @xiaozhu36, heguimin36@163.com)
84
142
85
143
License
86
144
-------
87
-
Mozilla Public License 2.0. See LICENSE for full details.
0 commit comments