Cloud Native 12 min read

One-Click Deploy Spring Cloud Microservice via Jenkins, Docker & K8s

This guide walks you through automating the full lifecycle of a Spring Cloud microservice—from pushing code to Git, configuring Jenkins pipelines with SSH keys, building with Maven, packaging into Docker images, pushing to a registry, and finally deploying and updating the service on Kubernetes—all with step‑by‑step commands and scripts.

Code Ape Tech Column
Code Ape Tech Column
Code Ape Tech Column
One-Click Deploy Spring Cloud Microservice via Jenkins, Docker & K8s

Overview

Deploy a Spring Cloud microservice with a single click using Jenkins, Docker, and Kubernetes. The process includes pushing code to Git, Jenkins pulling the code, Maven building, Docker image creation and registry push, and Kubernetes service deployment.

Developer pushes code to Git.

Jenkins pulls the code automatically.

Maven builds the project.

The resulting JAR is packaged into a Docker image and pushed to a Docker registry.

Kubernetes deploys or updates the service.

1. Configure SSH Key for Jenkins

Jenkins needs password‑less access to the Git repository. Generate an SSH key pair, add the public key to the Git platform (e.g., Gitee), and test the connection.

ssh-keygen -t ed25519 -C "[email protected]"

Copy the content of ~/.ssh/id_ed25519.pub and add it as a deployment public key in the repository settings.

SSH key addition
SSH key addition

Verify the SSH connection:

ssh -T [email protected]
SSH test result
SSH test result
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DockerCI/CDKubernetesdevopsSpring CloudmicroserviceJenkins
Code Ape Tech Column
Written by

Code Ape Tech Column

Former Ant Group P8 engineer, pure technologist, sharing full‑stack Java, job interview and career advice through a column. Site: java-family.cn

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.