Join us

Oracle Cloud Infrastructure- OKE and Terraform

Provisioning Kubernetes cluster using terraform. In this article, I am going describe the requirements to provision a Kubernetes cluster on OCI using terraform and deploying an application on Kubernetes cluster

Oracle Cloud Infrastructure

The next-generation cloud is designed to run any application, faster and more securely, for less. Try Oracle Cloud for free

Container Engine for Kubernetes (OKE)

Oracle Cloud Infrastructure Container Engine for Kubernetes is a fully-managed, scalable, and highly available service that you can use to deploy your containerized applications to the cloud. Use Container Engine for Kubernetes (OKE) when your development team wants to reliably build, deploy, and manage cloud-native applications


Terraform is an infrastructure as code (IaC) tool that allows you to build, change, and version infrastructure safely and efficiently. This includes low-level components such as compute instances, storage, and networking, as well as high-level components such as DNS entries, SaaS features, etc.


OCI Terraform Module

Install Terraform

For creating a OKE cluster what you need

  • A VCN, an Internet Gateway, a NAT gateway for private worker node deployment
  • worker subnets( public/private)with a set of security rules
  • load balancer subnets with its security rules

Step 1: Clone the terraform from git and cd terraform-oci-oke folder

Step 2: cp terraform.tfvars.example terraform.tfvars

Step 3: Finish Prerequisites or Check my Video(coming soon..)

Create a file in root add 2 providers

Provider 1 -home regions

Provider 2- the current region where you want to provision your cluster.

                provider "oci" {
  fingerprint      = var.api_fingerprint
  private_key_path = var.api_private_key_path
  region           = var.region
  tenancy_ocid     = var.tenancy_id
  user_ocid        = var.user_id

provider "oci" {
  fingerprint      = var.api_fingerprint
  private_key_path = var.api_private_key_path
  region           = var.home_region
  tenancy_ocid     = var.tenancy_id
  user_ocid        = var.user_id
  alias            = "home"

step 4: Run terraform init command in the root folder

Step 4: Modify terraform.tfvars and add the fields copied in the prerequisites

For example:

Step 5: Run terraform plan command in the root folder to check any actions are required.

Step 6: Run terraform apply command in the root folder. This would create your OKE Cluster

Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

User Popularity



Total Hits



Mentioned tools