OCI OKE(Kubernetes Engine) Deployment Using Terraform and OCI Resource Manager
In this blog , i am going to deploy Oracle Kubernetes Engine using Terraform and Resource Manager.
This blog divided into four sections :
1) Prepare Terraform Files for VCN , Kubernetes Cluster and Node Deployment.
2) Prepare schema.yaml to pass all variable options from Resource Manager
3) Then we will prepare resource manager and apply above.
4) Finally we will deploy one sample Application and try to launch from internet.
Before going through Terraform files , let's understand Network Architecture.
In this Network Architecture both Control Plane API and Loadbalancer in Public Subnet so that we can access it from Internet where as Worker nodes is in Private subnet.
VCN CIDR : 192.168.32.0/22
Public subnet : 192.168.32.0/24
Public-lb-subnet : 192.168.33.0/24
Private subnet : 192.168.34.0/24
With the help of Terraform I am going to deploy VCN , subnet , Internet Gateway , NAT Gateway , Service Gateway and Security Lists.
Let's create VCN using terraform :
Post VCN terraform .tf is ready , we need to prepare Cluster and Nodes .tf files.
In this i have mentioning Endpoint Public IP should be enabled.
Added Pods_cidr and services_cidr.
Also subnet used for lb.
I have collecting data for my Availability domains as i need to deploy nodes in three availability domain.
I need to give Kubernetes image id for deployment.
You can capture output as per your requirement.
Since i am going to deploy all above terraform configuration using OCI resource manager , we need to prepare schema.yaml to pass variable inputs.
We need to follow this format :
1) Variable Groups : where we need to declare all variable name within specific title.
2) Variables : where we need to mention type and message.
Now we have all files ready , let's login to Resource manager.
Go to OCI -> Developer services -> Resource manager -> stacks
I have create OCI_OKE_deploy stack :
Here i have uploaded all above files
In Configuration Variables i have mentioned and selected all values:
After entering all these details we have save it and click on Plan.
As you can see my plan job succeeded , let's apply this config.
This will take around 20 min to apply this config.
we can see all logs in Job section.
JOB completed i can see
VCN deployed successfully.
Cluster Deployed :
Nodes Deployed :
Now OKE cluster is ready , let's test our application.
App deployment successfully completed.
You can download all files from Github repository: