Go through the following steps to set up a canary deployment:
- Open the message-service project we've worked on in the previous recipes. Add the following Dockerfile file to the root directory of the project:
FROM openjdk:8-jdk-alpineVOLUME /tmpEXPOSE 8082ARG JAR_FILE=build/libs/message-service-1.0-SNAPSHOT.jarADD ${JAR_FILE} app.jarENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
- In order for Kubernetes to know whether the service is running, we need to add a liveness probe endpoint. Open the MessageController.java file and add a method to respond to GET requests at the /ping path:
package com.packtpub.microservices.ch09.message.controllers;import com.packtpub.microservices.ch09.message.MessageRepository; ...