- This tutorial is available in an Oracle-provided free lab environment.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Deploy Oracle Container Engine for Kubernetes
A Kubernetes cluster is a group of nodes. The nodes are the machines running applications. Each node can be a physical machine or a virtual machine. The node’s capacity (its number of CPUs and amount of memory) is defined when the node is created. A cluster comprises:
- one or more master nodes (for high availability, typically there will be a number of master nodes)
- one or more worker nodes (sometimes known as minions)
A Kubernetes cluster can be organized into namespaces to divide the cluster’s resources between multiple users. Initially, a cluster has the following namespaces:
- default, for resources with no other namespace
- kube-system, for resources created by the Kubernetes system
- kube-node-lease, for one lease object per node to help determine node availability
- kube-public, usually used for resources that have to be accessible across the cluster
- Create a Kubernetes cluster
- Deploy a sample app
Watch the video below for a demo of Oracke Kubernetes Enging (OKE) on Oracle Cloud Infrastructure.
Video for Oracle Kubernetes Engine OKE - Level 100 - Part 2 - OKE Cluster Demo
Create Kubernetes Cluster
Sign in to Oracle Cloud Infrastructure Console using your cloud tenant name, user name, and password.
From the OCI services menu, Click Kubernetes Clusters under Developer Services.
There is no need to create any policies for OKE as all the policies are pre-configured.
Under List Scope, select your compartment.
Click Create Cluster. Choose Quick Create and click Launch Workflow.
Fill out the dialog box:
- Name: Provide a name (oke-cluster in this example)
- Compartment: Choose your compartment
- Choose Visibility Type: Public
- Shape: Choose a VM shape
- Number of Nodes: 1
Click Next and click Create Cluster.
We now have an OKE cluster with 1 node and virtual cloud network with all the necessary resources and configuration needed.
Check OCI CLI in Cloud Shell
OCI Command Line comes preinstalled in Oracle Cloud Shell.
Check the installed version of OCI CLI.
Start up the Oracle Cloud Shell if it’s not already running. Enter command:
to check the OCI CLI version, which should be 2.5.x or higher.
Initialize your Environment
Switch to the OCI Console window and navigate to your cluster. In cluster detail window, scroll down and click Quick Start under Resources.
Follow the steps under the Quick Start section.
The Quick Start directions will direct you to copy and execute the commands in your local terminal.
Deploy Nginx App on Cluster Using kubectl
Create nginx deployment with three replicas. Enter command:
kubectl run nginx --image=nginx --port=80 --replicas=3
Get Kubernetes deployment. Enter command:
kubectl get deployments
Get Pods. Enter command:
kubectl get pods -o wide
Create a service to expose the application. The cluster is integrated with the OCI Cloud Controller Manager (CCM). As a result, creating a service of type
--type=LoadBalancerwill expose the pods to the Internet using an OCI Load Balancer. In the terminal, enter command:
kubectl expose deployment nginx --port=80 --type=LoadBalancer
Switch to the OCI Console window. From the OCI services menu, click Load Balancers under Networking. A new OCI LB should be getting provisioned (this is due to the command above).
Once the load balancer is active, click the load balancer name, and from the Load Balancer Information page, note down its IP address.
Open a new browser tab and enter URL http://
<Load-Balancer-Public-IP>(http://188.8.131.52 in this example). The Nginx welcome screen should be displayed.
Delete the Resources
Note- You can ignore the Delete the Resources section if you’re using Oracle’s free tenancy, otherwise deleting resources in your own tenancy is optional.
Delete OKE Cluster
To navigate back to your OCI Console window, click Container Clusters (OKE) under Developer Services.
Navigate to your cluster. Click Delete Cluster and then click Delete in the confirmation window.
From the OCI services menu, click Virtual Cloud Networks under Networking. A list of all VCNs will appear.
Locate your VCN, click the Action icon, and then click Terminate. Click Delete All in the confirmation window. Click Close once the VCN is deleted.
Delete API Key
To navigate to user settings, click the Profile icon in the top right corner of the window. Then, select User Settings.
Scroll down to select API Keys under the Resources section.
Click on the Action icon and click Delete to delete the API key.
- Authors - Flavio Pereira (OCI Product Manager), Larry Beausoleil (OCI Enablement)
- Contributors - LiveLabs QA Team (Arabella Yao, Product Manager Intern; Isa Kessinger, QA Intern), Yaisah Granillo (Cloud Solution Engineer), Orlando Gentil (OCI Product Manager)
Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.
For product documentation, visit Oracle Help Center.
Deploy Oracle Container Engine for Kubernetes
Copyright © 2021, Oracle and/or its affiliates.
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services, except as set forth in an applicable agreement between you and Oracle.