top of page
  • Twitter Social Icon
  • LinkedIn Social Icon
  • Facebook Social Icon

OCI OKE(Kubernetes Engine) Deployment Using Terraform and OCI Resource Manager

  • Writer: Nikhil Verma
    Nikhil Verma
  • Apr 5, 2023
  • 2 min read

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.


ree


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 :


ree

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.


ree

For Node.tf

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.


ree

You can capture output as per your requirement.


ree

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.


ree

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 :


ree

Here i have uploaded all above files



ree

In Configuration Variables i have mentioned and selected all values:

ree

ree

ree

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.


ree

ree

This will take around 20 min to apply this config.

we can see all logs in Job section.


ree

JOB completed i can see


VCN deployed successfully.


ree

Cluster Deployed :


ree


Nodes Deployed :


ree


Now OKE cluster is ready , let's test our application.

ree

ree

ree

App deployment successfully completed.


You can download all files from Github repository:


https://github.com/vnikhil89/OCI-OKE-deploy

Comments


  • Grey Twitter Icon
  • Grey LinkedIn Icon
  • Grey Facebook Icon
bottom of page