-
Have an account for a Docker registry images. You can use Docker or Quay.io
-
Have a Kubernetes instances. You can run this using either Minikube, CodeReady Containers or Docker Desktop
-
You can generate a Docker image with the following command:
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=<you-id>/contacts-app:v1
-
Push you image
docker push <your-id>/contacts-app:v1
|
Warning
|
Use your docker id and replace it. |
kubectl create namespace spring
kubectl config set-context --current --namespace spring-
You can generate the deployment with the following commands, make the necessary adjustments and deploy it to your Kubernetes instance.
kubectl create deployment demo --image=<your-id>/contacts-app:v1 --dry-run=client -o=yaml > deployment.yaml echo --- >> deployment.yaml kubectl create service contacts-app --tcp=8080:8080 --dry-run=client -o=yaml >> deployment.yaml
kubectl create configmap contacts-config --from-file=./src/main/resources/application.yaml -n spring|
Note
|
Assuming you have created the spring namespace
|