Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Contacts

Requirements

Generate Docker Image

  • 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.

Create a new namespace spring

kubectl create namespace spring
kubectl config set-context --current --namespace spring

Creating a Kubernetes deployment

  • 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

ConfigMap

kubectl create configmap contacts-config --from-file=./src/main/resources/application.yaml -n spring
Note
Assuming you have created the spring namespace

Deployment

This is the final deployment file:

k8s-deployment.yaml
link:cloud/k8s-deployment.yaml[role=include]