Note:

Set up Oracle Cloud Infrastructure Container Engine for Kubernetes with Three Worker Nodes

Introduction

In this tutorial, we will explain how to set up a Kubernetes cluster consisting of the Kubernetes control plane and the data plane (node pool) using the Oracle Cloud Infrastructure Container Engine for Kubernetes (OKE). We will also deploy and delete two sample applications on the Kubernetes platform to prove it works. This tutorial will set the stage for future tutorials that will dive into networking services offered inside Kubernetes for container-hosted applications.

image

image

The example OKE deployment models are:

For more information about the different OKE deployment models we can choose, see Example Network Resource Configurations.

In this tutorial, we will implement the Example 3 deployment model.

Objectives

Task 1: Create a New Kubernetes Cluster and Verify the Components

The Kubernetes control cluster and worker nodes are fully deployed and configured inside Oracle Cloud Infrastructure (OCI). This is what we call the Oracle Cloud Infrastructure Container Engine for Kubernetes.

Task 2: Verify the Deployed Kubernetes Cluster Components in the OCI Console

When we use OKE to create a Kubernetes cluster some resources will be created inside OCI to support this deployment.

The first and most important resource is the virtual cloud network (VCN). Because we have chosen the Quick Create option, a new VCN dedicated to OKE was created.

If we place every piece of information we have just collected and place that in a diagram then diagram will look like as shown in the following image.

image

Task 3: Verify the Kubernetes Cluster is Running using the CLI

The connection is made to perform management on the OKE cluster using OCI Cloud Shell.

image

Task 4: Deploy a Sample Nginx Application using kubectl

Task 5: Deploy a Sample MySQL Application using Helm Chart

Task 6: Clean up the Pods and Namespaces

We have deployed an application in the default namespace (Nginx) and another application in a new namespace (MySQL). Using Helm charts, let us clean up the environment so we can start fresh whenever we need to.

  1. Use the following command to get all the worker nodes (cluster-wide).

    kubectl get nodes -o wide
    
  2. Use the following command to get all the running pods in the current (default) namespace.

    kubectl get pods -o wide
    
  3. Run the following command to get all the namespaces.

    kubectl get namespaces
    
  4. Run the following command to get all the running pods in the current (default) namespace specifically.

    kubectl get pods --namespace=default
    
  5. Run the following command to get all the running pods in the MySQL namespace specifically.

    kubectl get pods --namespace=mysql
    

image

image

image

  1. Run the following command to delete all deployments or pods in the default namespace.

    kubectl delete --all deployments --namespace=default
    
  2. Use the following command to verify if the deployments or pods are deleted.

    kubectl get pods --namespace=default
    
  3. Use the following command to get all the running pods in the MySQL namespace specifically. Just verify if this still exists.

    kubectl get pods --namespace=mysql
    

image

  1. Run the following command to delete all deployments or pods and the complete MySQL namespace.

    kubectl delete namespace mysql
    
  2. Use this command to gather all the namespaces, and verify if the MySQL namespace is deleted.

    kubectl get namespaces    
    

image

Acknowledgments

More Learning Resources

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.