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:
- # kubectl run nginx –image=nginx –port=80 –replicas=3
- # kubectl get deployments
- # 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.