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.
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.
Verify the SSH connection:
ssh -T [email protected]Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
