Part 6 – Deploying an Application on OKE

Having created a Kubernetes cluster using Container Engine for Kubernetes, you’ll typically want to try it out by deploying an application on the nodes in the cluster. For convenience, the Cluster page includes a Getting Started tab that makes it easy to view and copy the commands to:

  • download the kubeconfig configuration file for the cluster
  • download and deploy a sample Nginx application using the Kubernetes command line tool kubectl
  • start the Kubernetes Dashboard to view the deployed application running on nodes in the cluster

Create a nginx deployment with three replicas by using the following command:

  1. # kubectl run nginx –image=nginx –port=80 –replicas=3
  2. # kubectl get deployments
  3. # 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=LoadBalancer will expose the pods to the Internet using an OCI Load Balancer.

# kubectl expose deployment nginx –port=80 –type=LoadBalancer

List service to get the external IP address (OCI LoadBalancer) of your exposed service. Note, the IP will be listed as <pending> while the load balancer is being provisioned

# kubectl get services

If we take a look at the OCI Console -> Networking -> Load Balancers tab, we will see that a new OCI LB is being provisioned for our service. Once provisioned we’ll see the external IP.

On your browser open http://Load-Balancer-Public-IP.

 

About Prasenjit Sarkar

Prasenjit Sarkar is a Product Manager at Oracle for their Public Cloud with primary focus on Cloud Strategy, Cloud Native Applications and API Platform. His primary focus is driving Oracle’s Cloud Computing business with commercial and public sector customers; helping to shape and deliver on a strategy to build broad use of Oracle’s Infrastructure as a Service (IaaS) offerings such as Compute, Storage, Network & Database as a Service. He is also responsible for developing public/private cloud integration strategies, customer’s Cloud Computing architecture vision, future state architectures, and implementable architecture roadmaps in the context of the public, private, and hybrid cloud computing solutions Oracle can offer.

Leave a Reply