This is an example to create a Kubernetes Cluster on IBM Cloud in a VPC.
The example is based on following resources:
- IBM Cloud VPC Gen 2 cluster example
- Terraform Registry
- Networking for the VPC and Kubernetes Clusters
It creates/configures on IBM Cloud:
-
1 x VPC
-
3 x Security Groups
- 1 x Default
- 2 x Related to the Kubernetes Cluster (created by the Kubernetes Service creation)
-
1 x Access control list
-
1 x Routing table
-
1 x Virtual Private Endpoint Gateway (created by the Kubernetes Service creation)
-
1 x Public load balancer (created by the Kubernetes Service creation)
-
-
1 Kubernetes Cluster
- Including 3 fully IBM managed master nodes
- Configured 2 Worker nodes (managed by IBM) (see responsibilities)
- Enabled Block Storage for VPC
- Enabled service endpoint for public and private communication
Name | Description | Type | Default Value |
---|---|---|---|
flavor | Default worker node flaver. Use 'ibmcloud ks flavors --zone us-south-1' to verify the availability. | String | bx2.4x16 |
worker_count | Default worker node count is set to 2. | Integer | 2 |
resource_group | IBM Cloud resource group name. | String | default |
vpc_name | The Virtual Private Cloud name. | String | operator-sample |
region | IBM Cloud region for the Kubernetes Cluster and the VPC | String | us-south |
kube_version | The tested Kubernetes Cluster version for the example is 1.23.8. | String | 1.23.8 |
cluster_name | Kubernetes Cluster Name running in VPC Gen2. | String | operator-sample-ks-cluster |
kubernetes_pricing | Kubernetes Cluster pricing. | String | tiered-pricing |
To use an example bash automation following tools need to be installed on the local computer
- IBM Cloud CLI
- Plugin VPC infrastructure
- Plugin Container-service
- Terraform
The setup contains steps to use terraform locally with a bash automation, but you can also use Schematics on IBM Cloud for the setup. Here is a blog post which does cover an example usage of Schematics link.
git clone https://github.com/thomassuedbroecker/terraform-vpc-kubernetes.git
cd terraform-vpc-kubernetes
nano variables.tf
cat variables_template.env > variables.env
nano variables.env
Content of the file:
export IC_API_KEY=YOUR_IBM_CLOUD_ACCESS_KEY
export TF_LOG=debug
export REGION="us-south"
export GROUP="default"
The creation can take up to 2 hours, depending on the which region you are using.
create_vpc_kubernetes_cluster_with_terraform.sh