Automatic Deployment
In General
- Create your application and the Dockerfile
- Run
mvn package
- Create Docker image
docker build -t <image_name> .
docker run -p 8080:8080 <image_name>
- Create
deployment.yaml
- Specify the image name, port and number of replicas
- Create
service.yaml
- define the service type and port
- Apply the change to K8S cluster
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
- Check the result:
kubectl get pods
kubectl get svc