Kubernetes Engine

Create a Kubernetes cluster and deploy a container.

Kubernetes Engine is a secured and managed Kubernetes service so you can deploy containerized application in an enterprise/production-grade Kubernetes cluster with a click of a button.

Getting Started

Clone

cd $HOME
git clone https://github.com/saturnism/jvm-helloworld-by-example
cd jvm-helloworld-by-example/helloworld-springboot-tomcat

Build

./mvnw package

Containerize

Enable API

Enable the Container Registry API so that you can push container images to Container Registry.

gcloud services enable containerregistry.googleapis.com

Jib

Use Jib to containerize the application:

Learn different ways to containerize a Java application in the Container Image section.

Create Cluster

Enable API

Create Cluster

Create a VPC-native Kubernetes Engine cluster.

See Compute Engine Machine Types documentation for a list of Machine Types and the associated CPU/Memory resources.

Cluster Credentials

Kubernetes credentials are automatically retrieved and stored in your $HOME/.kube/config file. If you need to re-retrieve the credentials:

Deploy

Check that the container is deployed:

Expose

You can expose this one service using a single Network (L4) Load Balancer:

A Network (L4) Load Balancer is the easiest way to expose a single service for a demo. For production environment, you likely will need to use a HTTP Load Balancer instead.

Connect

Find the Load Balancer's External IP address:

Initially, it may display that the External IP is <pending>.

Re-check until the External IP is assigned.

Then connect with curl:

Learn More

Last updated

Was this helpful?