Kubernetes Using Cloud Shell: Deploy a Spring Boot Application
In this tutorial, you use an Oracle Cloud Infrastructure account to set up a Kubernetes cluster. Then, you deploy a Spring Boot application to your cluster. Key tasks include how to:
- Set up an authentication token.
- Set up a Kubernetes cluster on OCI.
- Build a Spring Boot application and Docker image.
- Push your image to OCIR.
- Deploy your Docker application to your cluster using Cloud Shell.
- Connect to your application from the internet.

For additional information, see:
Before You Begin
To successfully perform this tutorial, you must have the following:
- A paid Oracle Cloud Infrastructure account. See Signing Up for Oracle Cloud Infrastructure .
- SSH support:
- A MacOS or Linux computer with
ssh
support installed. - A Windows machine with Git Bash installed. See Git for Windows.
- A MacOS or Linux computer with
1. Gather Required Information
Prepare the information you need from the Oracle Cloud Infrastructure Console.
2. Create SSH Encryption Keys
Create ssh
encryption keys to connect to your compute
instance.
You have generated the required encryption keys.
See Creating a Key Pair for more detailed information
on generating ssh
encryption keys.
3. Create your Virtual Cloud Network (VCN)
Setup a VCN to connect your Linux instance to the internet. You configure all the components needed to create your virtual network.
To open a different port, replace 8080 in the last step with the port number.
4. Install your Oracle Linux VM
5. Configure your Oracle Linux VM
Next, configure your VM so you can build and deploy the your application image to Oracle Cloud Infrastructure Registry (OCIR).
Follow these steps to setup your VM so you can build your application:
Install Git
Install Git v2 using the IUS Community Project (https://ius.io/) Spring Boot Docker
tutorial. Navigate to the current version of Git core package and download to a
~/temp
directory. For example, installing the Git 2.2.4
core package looks like this.
Install JDK 8
Install Maven 3.6
Install Maven from an Apache mirror. Go to the main Maven site's (https://maven.apache.org/) download page. Get the the URL for the latest version and download with wget.
Build Your Spring Boot Application
Now, build your Spring Boot application.
6. Build and Push your Spring Boot Application
Next, install Docker and build your Docker image so you can deploy the image to Oracle Cloud Infrastructure Registry (OCIR).
Install Docker
Install Docker on your Oracle Linux VM.
Build your Docker Image
Build a Docker image for your application.
Push your Docker image to OCIR
With your Docker image created, now you need to push it to OCIR.
View the OCIR Repository you Created
7. Create your Kubernetes Cluster
Set up the Kubernetes cluster you will deploy your application to. You will use a wizard to set up your first cluster.
8. Manage your Kubernetes Cluster with Cloud Shell
With your Kubernetes cluster setup, you need to configure your Cloud Shell instance. To do that, complete the following steps:
With your cluster configured, you are now ready to prepare your application for deployment.
9. Deploy your Docker Image to your Cluster with Cloud Shell
Create a Secret to Securely Connect to OCIR
Create a Manifest file and Deploy your Image
With your image in OCIR, you can now deploy your image and app.
Your load balancer may take a few seconds to load after issuing the command.
After you are done, cleanup and remove the services you created.
What's Next
You have successfully created a Hello World application, deployed it to a Kubernetes cluster and made it accessible on the internet, using Spring Boot.
To explore more information about development with Oracle products check out these sites: