首页 > 解决方案 > 在生产环境中使用 K8 部署 Spring Boot 微服务

问题描述

我是 k8 设置的新手,我想知道在生产中部署服务的最佳方式是什么。以下是我能想到的几种方法,你能指导我正确的方向吗?

1) Deploy each *.war file into a apache tomcat docker container, and using the service discovery mechanism of k8's.
2) Run each application normally using "java -jar *.war" into pods and expose their ports using port binding.

谢谢。

标签: spring-boottomcatkubernetesmicroservices

解决方案


The canonical way to deploy applications to Kubernetes is as follows:

  1. Package each application component in a container image and upload it to a container registry (e.g. Docker Hub)
  2. Create a Deployment resource for each container that runs the container as a Pod (or a set of replicas of Pods) in the cluster
  3. Expose the Pod(s) in each Deployment with a Service so that they can be accessed by other Pods or by the user

推荐阅读