This terraform configuration is used to build a RKE cluster on cloud.ca infrastructure.
- Resources
- Requirements
- Available Kubernetes Versions
- Required Inputs
- Optional Inputs
- Outputs
- Usage
- License
It will create the required infrastructure:
- one or several k8s master node(s)
- two or several k8s worker nodes
- Terraform 0.12+
- Terraform Provider for cloud.ca 1.5+
- Terraform Provider for RKE 0.14.1
- terraform-docs 0.5+
Version of Kubernetes to be used in the RKE cluster can be controlled with kubernetes_version, which depends on the version of terraform-provider-rke being used in which depends on the version of RKE binary beind used in that provider version.
To get the list of available (and the default) version of Kubernetes take a look at release notes of terraform-provider-rke and RKE respectively.
The following input variables are required:
Description: cloud.ca API key to use
Type: string
Description: The environment ID to create resources in
Type: string
Description: The network ID to create resources in
Type: string
Description: The vpc ID of the network used
Type: string
Description: The list of students attending the workshop
Type: list
Example:
[
"phil",
"scott"
]
The following input variables are optional (have default values):
Description: Kubernetes version to install in the cluster
Type: string
Default: "v1.15.3-rancher1-1"
Description: Number of master node(s) to create
Type: string
Default: "1"
Description: Prefix to be used in name of instances, e.g. cca
in cca-foo-service01
Type: string
Default: "cca"
Description: Service to be used in name of instances, e.g. service
in cca-foo-service01
Type: string
Default: "rke"
Description: Type to be used in name of instances, e.g. foo
in cca-foo-service01
Type: string
Default: "cluster"
Description: The username to create in the nodes with SSH access
Type: string
Default: "student"
Description: The password for the student to sign in to the workshop
Type: string
docker run --rm -it flyinprogrammer/mkpasswd --method=SHA-512 --rounds=4096
Description: Number of worker node(s) to create
Type: string
Default: "2"
The following outputs are exported:
Description: List of private IP of master node(s)
Description: List of private IP of worker node(s)
Description: List of master endpoint IPs to access the clusters externally
-
Clone the repository into an appropriate name:
git clone https://github.com/khos2ow/cloudca-rke-cluster.git cloudca-rke-cluster
-
Create
terraform.tfvars
containing:api_key = "<cloud_ca_API_KEY>" vpc_id = "<cloud_ca_VPC_ID>" environment_id = "<cloud_ca_ENVIRONMENT_ID>" network_id = "<cloud_ca_NETWORK_ID>" students = [ "<STUDENT_NAME>" ]
-
Execute the following command to initialize the repository:
make init plan
MIT License
Copyright (c) 2019 Khosrow Moossavi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.