Skip to content

scalasm/aws-k8s-hello-world

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello World w/ Spring Boot and Skaffold

This is a sample project for demo purposes, providing a simple RESTful API with a simple HTTP POST endpoint.

It shows how to

  1. package a Spring Boot app into a Docker image, using Skaffold and Google Jib;
  2. Deploy it into your Kubernetes cluster.

Requirements

You will need the following in your system:

(Note: if you want to work directly with your remote AWS cluster, having a local cluster is not strictly needed but strongly advised!)

Suggested

IDE(s)

Video and tutorials

Quickstart

Set your context (use "" if you want to use your local docker daemon registry cache and avoid to deploy to a remote private registry):

Please take a look at Skaffold docs for more commands and configurations!

Dev Workflows

You can run the following commands by terminal or use the facilities provided by IDE(s).

Code-deploy-run cycle

You code in your IDE while the system listen for changes and build/redeploys to your cluster in background.

skaffold dev

(Note: you can tune the timeouts :))

Code and run

You code in your IDEs and deploy/run explicitly by typing:

skaffold run --tag=dev

(Note: if you don't specify the tag, then the latest will be used: keep this in mind with your K8S deployments!)

Happy coding!

Delete your deployment

skaffold delete

FAQ

1. How do I push images built locally to remote ECR repository?

You have to do the docker login first and then run Skaffold. For example, when using AWS CLI v2 (as always, change account id and region):

mario@Sharkey:~/src/medium-articles/aws-k8s-hello-world$ aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin xxxxxxxxxxxxxxx.dkr.ecr.eu-central-1.amazonaws.com
Login Succeeded
mario@Sharkey:~/src/medium-articles/aws-k8s-hello-world$ skaffold run -p aws --tag=dev --default-repo xxxxxxxxxxxxxxx.dkr.ecr.eu-central-1.amazonaws.com/hello-world-app
Generating tags...
 - hello-world -> xxxxxxxxxxxxxxx.dkr.ecr.eu-central-1.amazonaws.com/hello-world-app/hello-world:dev
Checking cache...
 - hello-world: Found. Pushing
...
...

About

Hello World sample for CI/CD with Skaffold and AWS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages