spring-boot - 在生产环境中使用 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.
谢谢。
解决方案
The canonical way to deploy applications to Kubernetes is as follows:
- Package each application component in a container image and upload it to a container registry (e.g. Docker Hub)
- Create a Deployment resource for each container that runs the container as a Pod (or a set of replicas of Pods) in the cluster
- Expose the Pod(s) in each Deployment with a Service so that they can be accessed by other Pods or by the user
推荐阅读
- algorithm - 星型算法:使用启发式值作为 Tie-breaker,其中节点具有相同的 F 值
- sql-server - 从一列中提取字符并将它们填充到 2 个不同的列中 ssis 派生列
- javascript - 如何在 React 中设置类对象?
- javascript - 如何使用 Chart.js 2 在图表栏顶部添加标签
- flutter - 如何布局不同高度的卡片列表?
- scala - 将案例类的选项转换为其元素的元组
- vagrant - 在 Vagrant 上使用 NFS 时,composer 更新错误:addClassMap() 必须是数组类型,给定整数
- javascript - iFrame 的容器未捕获事件,即使在捕获阶段也是如此
- mysql - 伪装成mysql服务器
- excel - 复杂的 N 列 每 x 行 转置