Kubernetes 部署与 StatefulSets [英] Kubernetes Deployments vs StatefulSets

查看:31
本文介绍了Kubernetes 部署与 StatefulSets的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在对 Kubernetes 进行大量挖掘,而且我很喜欢我所看到的很多东西!我一直无法清楚地了解 Deployment 和 StatefulSet 资源之间的确切区别是什么,以及您将在哪些场景中使用它们(或者通常首选一种而不是另一种).

I've been doing a lot of digging on Kubernetes, and I'm liking what I see a lot! One thing I've been unable to get a clear idea about is what the exact distinctions are between the Deployment and StatefulSet resources and in which scenarios would you use each (or is one generally preferred over the other).

推荐答案

Deployments 和 ReplicationControllers 用于无状态使用并且相当轻量级.StatefulSets 在 state 有要坚持.因此,后者在持久卷上使用 volumeClaimTemplates/声明,以确保它们可以在组件重新启动时保持状态.

Deployments and ReplicationControllers are meant for stateless usage and are rather lightweight. StatefulSets are used when state has to be persisted. Therefore the latter use volumeClaimTemplates / claims on persistent volumes to ensure they can keep the state across component restarts.

因此,如果您的应用程序是有状态的,或者您想在 Kubernetes 之上部署有状态存储,请使用 StatefulSet.

So if your application is stateful or if you want to deploy stateful storage on top of Kubernetes use a StatefulSet.

如果您的应用程序是无状态的,或者可以在启动期间从后端系统建立状态,则使用部署.

If your application is stateless or if state can be built up from backend-systems during the start then use Deployments.

有关运行有状态应用程序的更多详细信息,请参见 2016 kubernetes 关于有状态应用的博文

Further details about running stateful application can be found in 2016 kubernetes' blog entry about stateful applications

这篇关于Kubernetes 部署与 StatefulSets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆