Spring Application Deployed with Kubernetes
Step by step building an application using Spring Boot and deployed via Docker on Kubernetes with Helm
full course- Setup: IDE and New Project
- Create the Data Repository
- Building a Service Layer
- Create a REST Controller
- Logging, Tracing and Error Handling
- Documentation and Code Coverage
- Database as a Service
- Containerize the Service With Docker
- Docker Registry
- Automated Build Pipeline
- Helm for Deployment
- Setting up a Kubernetes Cluster
- Automating Deployment (for CICD)
- System Design
- Messaging and Event Driven Design
- Web UI with React
- Containerizing our UI
- UI Build Pipeline
- Put the UI in to Helm
- Creating an Ingress in Kubernetes
- Simplify Deployment
- Conclusion and Review
In the previous article we created a docker image as part of our build process and stored it into our local repository. In order to deploy it in an automated fashion we should create a remote image repository in the cloud. This will expand the types of tools that we can use as well as allow for a gitops workflow that will automatically deploy our application when code is released into the master branch.
Remote Docker Registry
Create a Docker Registry
There are plenty of cloud based docker registries. ECR is a very good choice but the free tier only allows for 500MB of storage. Each of our images is going to be around 100MB and each release is going to generate an image, so we would only need a few services with a few versions before we started running out of space.
We’re going to use codefresh for the docker repository. Go ahead and create an account at codefresh. Codefresh gives you a docker repository on creation. Lets get the details. Go to Account Settings, under Integrations select docker registry. Hit the pencil on the default registry (mine is cfcr) and click on generate token. At the bottom here under codefresh registry generate a new token. Call it local
and hit the create button. Save this token somewhere and click the copy docker login command to clipboard
to generate a login command we’re going to use to access this registry.
Pushing our Image Up
paste the contents of the clipboard into your CLI. It should look something like this:
docker login r.cfcr.io -u brianrook -p da3***
Lets tag the build we just made with the version number. We’re cloning our image into one that matches the remote repository name and adding the tag. Make sure to replace the ${account}
with the account name you created when you registered.
docker tag medium/medium-customer:latest r.cfcr.io/${account}/medium-customer:0.0.1-SNAPSHOT
and confirm that we have tagged it successfully
docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
r.cfcr.io/docketdynamics/medium-customer 0.0.1-SNAPSHOT 7f9b379551d8 50 years ago 260MB
medium/medium-customer latest 7f9b379551d8 50 years ago 260MB
Now lets push the tagged version up to the remote registry
docker push r.cfcr.io/${account}/medium-customer:0.0.1-SNAPSHOT
and confirm that it made its way into our remote repo
docker pull r.cfcr.io/docketdynamics/medium-customer:0.0.1-SNAPSHOT
0.0.1-SNAPSHOT: Pulling from docketdynamics/medium-customer
Digest: sha256:25bdbfe086162e262607fc800db458400c2d1bf4f9b9bf11e7c6c48cb75c8c2e
Status: Image is up to date for r.cfcr.io/docketdynamics/medium-customer:0.0.1-SNAPSHOT
r.cfcr.io/docketdynamics/medium-customer:0.0.1-SNAPSHOT
0 comments on “Docker Registry”Add yours →