Difficulty: beginner
Estimated Time: 40 minutes

Oracle Kubernetes Engine


Oracle Kubernetes Engine is the Oracle offering for a Kubernetes cluster. It is a pure Kubernetes offering with integration with the Oracle Cloud Infrastructure components, such as:

  • Load Balancer
  • OCI Compute
  • OCI Storage
  • OCI Network
  • OCI Security

If you are an Oracle Cloud Infrastructure customer that is looking for an alternative to deploy Kubernetes, OKE is a good option for that. You can use the Quick Create option, and in less than 20 minutes you will have a full Kubernetes cluster formed by:

  • Three (03) nodes
  • VCN
  • Internet Gateway
  • NAT Gateway

Plus the option to provision Kubernetes Administration Dashboard, as well as Tiller.

Scenario Pre-requisites

Scenario Description

In this scenario you will learn how to provision an Oracle Kubernetes Engine using the Quick Create Option. Once you have your cluster we will deploy an application based on Redis and Go. You will also learn:

  • How to configure your Oracle Cloud Infrastructure Command Line Interface (OCI CLI) to create the Kubernetes config file in order to manage your cluster using kubectl
  • How to register a Docker image within OCIR (Oracle Cloud Infrastructure Registry).
  • How to configure a Load Balancer
  • How to deploy an application to the Cluster
  • How to configure replicas for your application
  • How to dinamically scale your replicas, based on CPU consumption


This completes the Oracle Kubernetes scenario.

In this scenario, you've learned:

  • How to use the OCI web console to use the quick create wizard to create your first OKE cluster
  • You've also learned how to create a kube config file for an Oracle Kubernets based cluster
  • You've learned how to create namespaces, services, deployments, secrets
  • You've learned how to connect and use Oracle Containers Registry (OCIR)
  • You've learned how to push an image into OCIR
  • You've learned how to deploy a REDIS service and a Golang based API service


UNDER CONSTRUCTION: Introduction to Oracle Kubernetes Engine

Step 1 of 7

Step 1 - Create your first OKE Cluster

Wait for OCI CLI to be installed

You need to provide details on the OCI tenancy you will work in and the OCI user you will work as. Please edit these two files:

  • ~/.oci/config
  • ~/.oci/oci_api_key.pem

If you do not have the OCI config file, nor the oci API key yet, you can go through these steps: https://docs.cloud.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm

Once you have the config file and the api key, copy their contents in ~/.oci/config and ~/.oci/oci_api_key.pem respectively.

Now let's install Oracle CLI and kubectl, execute this:


Do not continue until you see the file /root/allSetInBackground appear. If it appears, then the OCI CLI has been installed and is connected to your tenant.

Try out the following command to get a list of all namespaces you currently have access to - based on the OCI Configuration defined above.

oci os ns get

If you get a proper response, the OCI is configured correctly and you can proceed. If you run into an error, ask for help from your instructor.

Let's also test that kubectl install and working properly, execute the following: kubectl version

You should receive something like this:

Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.3", GitCommit:"06ad960bfd03b39c8310aaf92d1e7c12ce618213", GitTreeState:"clean", BuildDate:"2020-02-12T13:43:46Z", GoVersion:"go1.13.7", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

Let´s also create the following environment variables, that we will use in the next steps:

export TENANT_OCID=$(grep -i 'tenancy' $HOME/.oci/config | cut -f2 -d'=' | head -1)

Policy pre-requisite

Before creating the cluster, you need to apply a Policy to allow OKE to manage your tenant resources. This policy creation is described here: https://docs.cloud.oracle.com/en-us/iaas/Content/ContEng/Concepts/contengpolicyconfig.htm#PolicyPrerequisitesService

Please create that policy before continue with the next section.

In this scenario we will use both the Oracle Cloud Infrastructure Web Console and the Oracle CLI. In particular in this first step, most of the things will be executed using the Web Console.

Please create that policy and then continue with the next section.

For the lab purposes you will be assigned with a LAB ID number, execute this with the ID that the instructor assigns to you:

export LAB_ID=1

Oracle Kubernetes Engine Cluster Creation

With your 30-days free trial account you can create an OKE instance, so let's do it. We will use the quick-create wizard, that simplifies the steps. In order to do that, go to your Tenant Dashboard and then go to this menu:

OKE Menu

Once there, click on the Create Cluster blue button:

OKE Create Cluster

Select the Quick Create option, and then Launch Workflow:

OKE Quick Create Option

Once in the workflow window, give MyFirstOKE as the name, select the compartment and leave the rest of the fields as default:

OKE Workflow

Let's create an enviornment variable with the value of the name of the OKE cluster:


In the lower part of the window enable both Tiller and Kubernetes Dashboard:

OKE Enable Tiller

Finally, click on Next:

OKE Click on Next

And read the summary for your cluster:

OKE Summary

Click on Create Cluster and wait for the cluster to be created. In the home page for OKE, wait for the status to be Active:

OKE Ready

Once the status turned into Active, you are about to be able to use it.

Let's go the next step!