Skip to content

Base OKE automated deployment with extras, to be used alone or by other Quickstarts

License

Notifications You must be signed in to change notification settings

oracle-quickstart/terraform-oci-oke-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Oracle Container Engine for Kubernetes (OKE) Quickstart Module


Warning

$${\color{red}This \space is \space a \space pre-release \space version \space of \space the \space module, \space some \space features}$$ $${\color{red}have \space not \space been \space migrated \space from \space MuShop's}$$ $${\color{red}OKE \space Cluster \space deployment \space yet.}$$

Stack Release Stack Build AquaSec TFSec Terraform Stack License Stack Downloads GitHub issues

This module handles opinionated Oracle Container Engine for Kubernetes (OKE) cluster creation on Oracle Cloud Infrastructure (OCI). This module is designed to be used with the OCI Resource Manager to deploy a cluster in a single step. The module can also be used with the OCI Terraform Provider to deploy a cluster using local or CloudShell Terraform cli.

Note: This project is an alternative to easily create an OKE cluster without the need to use external workarounds and do not need to create compute bastions or jump servers, even if deploying using private endpoints. This is a NO(null_resource ,remote_exec, operator instance, bastion_or_jump_server, out_of_tf_state_sh_scripts) project

Sub modules are provided to create a cluster with a single node pool, or a cluster with multiple node pools. Enables Cluster Autoscaler, OCI Vault(KMS) for customer-managed encryption keys for secrets, block volumes. The module also provides a sub module to create a cluster with a single node pool and a private endpoint to Oracle Resource Manager (ORM).

This repo also includes the modules for deploying the following cluster components on the OKE cluster:

Component Description
Kubernetes Cluster Autoscaler This module deploys the Kubernetes Cluster Autoscaler on the OKE cluster.
Metrics Server This module deploys the Metrics Server on the OKE cluster.
Kubernetes Ingress Nginx Controller This module deploys the Nginx Ingress Controller on the OKE cluster.
Prometheus This module deploys the Prometheus monitoring system on the OKE cluster.
Grafana This module deploys the Grafana monitoring system on the OKE cluster.
Cert Manager This module deploys the Cert Manager on the OKE cluster.

Usage

There are multiple examples included in the examples folder but simple usage is as follows:

module "oke-quickstart" {
  source = "github.com/oracle-quickstart/terraform-oci-oke-quickstart?ref=0.8.0"

  # Oracle Cloud Infrastructure Tenancy and Compartment OCID
  tenancy_ocid     = var.tenancy_ocid
  compartment_ocid = var.compartment_ocid
  region           = var.region

  # Note: Just few arguments are showing here to simplify the basic example. All other arguments are using default values.
  # App Name to identify deployment. Used for naming resources.
  app_name = "Basic"

  # Freeform Tags + Defined Tags. Tags are applied to all resources.
  tag_values = { "freeformTags" = { "Environment" = "Development", "DeploymentType" = "basic" }, "definedTags" = {} }

  # OKE Cluster arguments
  #   cluster_cni_type = "FLANNEL_OVERLAY" # Use "OCI_VCN_IP_NATIVE" for VCN Native PODs Network

  # OKE Node Pool 1 arguments
  #   node_pool_cni_type_1           = "FLANNEL_OVERLAY" # Use "OCI_VCN_IP_NATIVE" for VCN Native PODs Network
  node_pool_autoscaler_enabled_1     = true
  node_pool_initial_num_worker_nodes_1             = 3                                                                         # Minimum number of nodes in the node pool
  node_pool_max_num_worker_nodes_1 = 10                                                                      # Maximum number of nodes in the node pool
  node_pool_instance_shape_1     = { "instanceShape" = "VM.Standard.E4.Flex", "ocpus" = 2, "memory" = 64 } # If not using a Flex shape, ocpus and memory are ignored

  # VCN for OKE arguments
  vcn_cidr_blocks = "10.20.0.0/16"
}

Deploy Using Oracle Resource Manager

NOTE: If you aren't already signed in, when prompted, enter the tenancy and user credentials. Review and accept the terms and conditions.

  1. Click to deploy the stack

    Deploy to Oracle Cloud

  2. Select the region and compartment where you want to deploy the stack.

  3. Follow the on-screen prompts and instructions to create the stack.

  4. After creating the stack, click Terraform Actions, and select Plan.

  5. Wait for the job to be completed, and review the plan.

  6. To make any changes, return to the Stack Details page, click Edit Stack, and make the required changes. Then, run the Plan action again.

  7. If no further changes are necessary, return to the Stack Details page, click Terraform Actions, and select Apply.

Deploy Using the Terraform CLI

Prerequisites

Create a terraform.tfvars file and populate with the required variables or override existing variables.

Note: An example tfvars file is included for reference. Using this file is the preferred way to run the stack from the CLI, because of the large number of variables to manage.

To use this file just copy the example tfvars file and save it in the outermost directory. Next, rename the file to terraform.tfvars. You can override the example values set in this file.

Clone the Module

Clone the source code from suing the following command:

git clone github.com/oracle-quickstart/terraform-oci-oke-quickstart
cd terraform-oci-oke-quickstart

Running Terraform

After specifying the required variables you can run the stack using the following commands:

terraform init
terraform plan
terraform apply
terraform destroy -refresh=false

Terraform Variables

A complete listing of the Terraform variables used in this stack are referenced here.

What's a Terraform Module?

A Terraform Module refers to a self-contained packages of Terraform configurations that are managed as a group. This repo is a Terraform Module and contains many "submodules" which can be composed together to create useful infrastructure patterns.

Which projects use this Module?

MuShop LogoMuShop Logo - Dark Mode oci-cloudnative (MuShop) This project is a reference implementation of a cloud native microservices application on Oracle Cloud Infrastructure (OCI). It is a polyglot multi-tiered application that demonstrates how to build and deploy a cloud native application on OCI using Kubernetes, Docker, Istio and other open source technologies.
oci-micronaut (MuShop) This project is a fork of the original MuShop implementation which used different technologies for each individual Microservice applicationµ and is designed as a demonstration of how to use Micronaut to build applications for Oracle Cloud.
Unreal LogoUnreal Logo - Dark Mode oke-unreal-pixel-streaming This project deploys a Kubernetes cluster on Oracle Cloud Infrastructure (OCI) and deploys the Unreal Pixel Streaming demo application on the cluster.
Sysdig LogoSysdig Logo - Dark Mode oke-sysdig This project deploy a Sysdig Secure agent on an OKE cluster.
Snyk LogoSnyk Logo - Dark Mode oke-snyk This project deploy a Snyk agent on an OKE cluster.

Several other projects, samples, demos, and customers quickstarts also uses this module or used as base.

How is this Terraform Module versioned?

This Terraform Module follows the principles of Semantic Versioning. You can find each new release, along with the changelog, in the Releases Page.

During initial development, the major version will be 0 (e.g., 0.x.y), which indicates the code does not yet have a stable API. Once we hit 1.0.0, we will make every effort to maintain a backwards compatible API and use the MAJOR, MINOR, and PATCH versions on each release to indicate any incompatibilities.

Questions

If you have an issue or a question, please take a look at our FAQs or open an issue.

Contributing

This project welcomes contributions from the community. Before submitting a pull request, see CONTRIBUTING for details.

License

Copyright (c) 2021, 2022 Oracle and/or its affiliates. Released under the Universal Permissive License (UPL), Version 1.0. See LICENSE for more details.