Skip to content
/ Quarkus-Vertx-GKE Public template

Deploying a Quarkus-based Vert.x application to Google Kubernetes Engine (GKE)

Notifications You must be signed in to change notification settings

CynicDog/Quarkus-Vertx-GKE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Index

  1. Deploying Vert.x in Quarkus Application on GKE
  2. Development Environment
  3. Technologies Used
  4. Local Deployment with Minikube
    1. Prerequisites
    2. Configure Docker Client for Minikube
    3. Persistence Configuration and Running up the Service
    4. Package and Deploy the Application
    5. Test Deployment
  5. Deployment to Google Kubernetes Engine (GKE)
    1. Configure Google Cloud SDK
    2. Configure Docker Authentication for GCR
    3. Build and Push Container Image to GCR
    4. Create a GKE Cluster
    5. Connect to GKE Cluster
    6. Deploy the Application to GKE
    7. Reserve Static IP Address for the Deployed App
    8. Create DNS record set
  6. Conclusion

Deploying Vert.x in Quarkus Application on GKE

This project demonstrates deploying a Quarkus-based Vert.x application to Google Kubernetes Engine (GKE).

Development Environment

  • Operating System: macOS 13.2.1 (Build 22D68)

Technologies Used

  • Quarkus: A Kubernetes-native Java framework designed for fast startup and low memory footprint.
  • Minikube: A tool to run a single-node Kubernetes cluster locally for development and testing.
  • Google Kubernetes Engine (GKE): A managed Kubernetes service provided by Google Cloud Platform (GCP).
  • Jib: A container image building tool that simplifies packaging Java applications into container images without needing a Dockerfile.

Local Deployment with Minikube

Prerequisites

  • Ensure Minikube is installed and initialized:
minikube start

Configure Docker Client for Minikube

Configure the local Docker client to use the Docker daemon running inside Minikube:

eval $(minikube docker-env)

Persistence Configuration and Running up the Service

Generate Kubernetes Secret to initialize the database server and grant access:

kubectl create secret generic db-credentials --from-literal=username={USERNAME} --from-literal=password={PASSWORD}
kubectl apply -f postgresql_kubernetes.yml

Package and Deploy the Application

Build and deploy the application to Minikube with ARM64 platform support:

mvn clean package -Dquarkus.container-image.build=true \
    -Dquarkus.jib.platforms=linux/arm64/v8 \
    -Dquarkus.kubernetes.deploy=true

Test Deployment

Make a request to the deployed service to ensure successful deployment:

kubectl exec -it vertx-quarkus-demo-<POD_ID> -- /bin/bash
curl http://vertx-quarkus-demo/greeting

Deployment to Google Kubernetes Engine (GKE)

Configure Google Cloud SDK

Initialize and configure the Google Cloud SDK for authentication:

gcloud auth login
gcloud init

Configure Docker Authentication for GCR

Configure Docker authentication information to interact with Google Artifact Registry for Docker:

gcloud auth configure-docker

Build and Push Container Image to GCR

Build and push the container image to Google Container Registry using Jib:

mvn clean package -Dquarkus.container-image.build=true \
    -Dquarkus.container-image.push=true \
    -Dquarkus.jib.platforms=linux/arm64/v8

Create a GKE Cluster

Create a Kubernetes cluster on Google Kubernetes Engine: Capture 2024-04-07 at 11 48 25 AM

Connect to GKE Cluster

Connect your terminal to the generated Kubernetes cluster on GKE:

gcloud container clusters get-credentials {YOUR_CLUSTER_NAME} --region {YOUR_REGION} --project {YOUR_PROJECT_ID}

Deploy the Application to GKE

Deploy the Quarkus application to the GKE cluster:

mvn clean package -Dquarkus.kubernetes.deploy=true

Reserve Static IP Address for the Deployed App

To expose a Quarkus application to the public via Ingress with a global static IP address, follow these steps:

  1. Create a Global Static IP Address:

    gcloud compute addresses create {A_NAME_FOR_GLOBAL_STATIC_IP} --global
  2. Update Configuration: Add the following configuration, ensuring to include double quotation marks as shown:

    quarkus:
      kubernetes:
        ingress:
          expose: true
          annotations:
            "kubernetes.io/ingress.global-static-ip-name": "{A_NAME_FOR_GLOBAL_STATIC_IP}"
  3. Verify Configuration: Once configured, the generated kubernetes.yml manifest should contain the following in the metadata.annotations section:

    metadata:
      annotations:
        kubernetes.io/ingress.global-static-ip-name: {A_NAME_FOR_GLOBAL_STATIC_IP}
  4. Check Deployment: Verify if the application is deployed with the reserved static IP address:

    kubectl get ingress

    Example output:

    NAME      CLASS    HOSTS   ADDRESS              PORTS   AGE
    {PROJECT} <none>   *       {GIVEN_STATIC_IP}    80      31m
    
  5. Test Deployment: Ensure the application is accessible using the reserved static IP address:

    http http://{GIVEN_STATIC_IP}/

Create DNS record set

To point your domain to the deployed application using the reserved static IP address, you can use the Google Cloud DNS service:

gcloud dns --project={YOUR_PROJECT_NAME} record-sets create {ENTER_PREFIX_HERE}.{YOUR_DNS_NAME} --zone={YOUR_ZONE} --type="A" --ttl="300" --rrdatas={RESERVED_STATIC_IP}

About

Deploying a Quarkus-based Vert.x application to Google Kubernetes Engine (GKE)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published