英文:
Infrastructure as Code: How do you reconcile or balance mutable vs immutable aspects
问题
我们正在迁移到IaC的路径上,我支持不可变的概念。但我的团队提出了一些很好的问题,比如:“你希望我重新部署整个虚拟机群,只是因为我们需要进行小的更改吗?这不是有些过度吗?如果我只是运行一些远程Powershell来实施更改,会更快。”
我明白不可变性的好处。但这些问题让我开始思考是否应该调整我们对不可变性的理念。在我们的情况下,我们正在考虑使用Saltstack和Packer构建不可变的镜像。几十个虚拟机(以及其他超出此问题范围的基础设施项目)。Salt使得通过应用状态来实现不可变和可变的IaC变得容易。但无论使用何种工具,你在哪里划定不可变性的界限呢?
- 我们是否要100%不可变?每次更改都需要丢弃旧的虚拟机并引入新的。不通过状态(或任何手动方法)来应用更改。
- 还是我们采用混合方式?可能有一个非常基本的“基础”不可变镜像,而其他所有内容都可以以可变方式应用?(在我的情况下,通过saltstate)。失去了一些不可变性的好处,但获得了运行时的灵活性?请注意,我们仍然有变更管理的流程,所以我们不会失去对我们状态的跟踪。
答案可能是“要看情况”。但我很想听听是否有人有明智的策略,这些策略可以合理地应用一致性。什么属于不可变的Packer镜像?什么由salt状态来管理?
(我意识到这基本上是一个编排与配置管理的争论,但我已经投资了前者;我的问题是要多少,如果有的话,后者来协同,并且有哪些成功的策略。我已经阅读了似乎所有关于将两者结合使用的文章,但没有一个提供了有力的指导。)
英文:
We're on our migration path to IaC and I buy into the immutable concept. But my team is asking good questions, like: "you want me to redeploy an entire fleet of VMs just because we need to make a small change? Isn't that overkill? It would be faster if I just ran some remote Powershell to implement a change."
And I get the benefits of immutability. But the questions are pushing me to wonder if we should refine our concept of immutable. In our case, we're looking at Saltstack with Packer building immutable images. A few dozen VMs (plus other infrastructure items that are out of scope for this question). Salt makes having immutable and mutable IaC easy (the latter via applying states). But whatever your tool, where do you draw the line?
- Do we go 100% immutable? Every change requires throwing out an old VM and ushering in a new one. No applying changes via states (or any manual method)
- Or do we have a hybrid? Possibly a very basic "base" immutable image and everything else gets applied mutably? (Via saltstate in my case.) Losing some benefits of immutability but gaining runtime agility? Note that we'd still have change management in place, so it's not like we lose track of our states.
The answer here may be "it depends." But I'd love to hear if anyone has good strategies that make sense and can be applied consistently. What belongs in the immutable Packer image? What is owned by salt states?
(I realize this is basically an orchestration vs config management argument, but I'm already invested in the former; my question is how much, if any, of the latter to pepper in and what are successful strategies for that. I've read seemingly every article out there on combining the two but none with any good scripture.)
答案1
得分: 1
以下是翻译好的部分:
"Going to give a half answer to my own question, to close this out."
如果你读了互联网,不可变性是基础设施的至高目标,它只会带来好处。地球和火星上的每个人都想要它。但事实是,并不是每个人真的需要它,或者它对他们不起作用(坦白说,有很多文章说你需要权衡这种策略的收益和成本)。以下是我们在解决方案中使用的要点:
- 不可变性是一个目标。这是一个我们永远无法达到100%的目标,如果你从头开始进入IaC领域,可能不应该设定太高的目标。随着时间的推移,我们将把更多的东西转移到不可变的空间。从1%的不可变性开始是可以的。
- 变更管理和通过类似Salt states这样的方式推送IaC变更没有错。在许多情况下,这已经比我们这种情况下的人们所拥有的要好得多。
- 我们从Packer创建的最简单的“基础”镜像开始,通过Salt按需安装其他应用程序。随着时间的推移,更多的应用程序将内置到这些Packer镜像中。关键是首先构建一个可管理的IaC平台,如果你有任何类型的现有基础设施要开始使用,那么最简单的方法是通过配置管理。
因此,最终,对于我们来说,混合方法似乎效果最好,我认为对于大多数企业来说也是如此。除非你有一个专门负责维护你的IaC设置的大团队,否则完全不可变的平台可能是不切实际的。我希望这可以帮助与我处境相同的任何人。
英文:
Going to give a half answer to my own question, to close this out.
If you read the internet, immutability is the holy grail of infrastructure and there are only good things to come from it. Everyone on Earth and Mars wants it. But the truth is that not everyone really needs it, or it doesn't work for them (tbf, there are a lot of articles out there saying that you need to weigh the benefits/costs with that strategy). Below are the points we used in our solution:
- Immutability is a goal. It's a goal we will never get to 100% on, and if you're starting from scratch in the IaC space, you probably shouldn't set your goals too high on this. We will move more things to an immutable space over time. It's ok to start with 1% immutability.
- There is nothing wrong with change management and pushing IaC changes out via something like Salt states. In many cases, this is already going to be a huge improvement over what people in my boat have.
- We started with the simplest "base" images created by Packer, installing other apps as needed via Salt. Over time, more of those apps will be built into those Packer images. The key is first building a manageable platform for IaC, and the easiest way to do that is via config management, if you have any sort of existing infrastructure to start with.
So in the end, a hybrid approach seems to work best for us, and I think it will for most shops out there. Unless you have a massive team dedicated to maintaining your IaC setup, a completely immutable platform is likely unrealistic. I hope this helps anyone that was in the same place I was.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论