TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Does anyone use Terraform to deploy Kubernetes services in a large org?

10 点作者 sandspit超过 2 年前
Terraform supports Kubernetes service provisioning, but I've never seen anyone talk about using it at scale. On the surface, I worry a bit that there could be some impedance mismatch or bugginess, due to the layering-on of two state management solutions. Curious how it works in practice.

4 条评论

tmager超过 2 年前
Not a large org, but I dabbled with managing k8s with Terraform for a while and... did not have a great time. There were a few minor issues with state management and consistency between Terraform and k8s, but my main complaint was just that the k8s provider is very awkward to use. It for the most part works, but:<p>- It isn&#x27;t an autogenerated wrapper around the k8s API, so not 100% of features are supported. E.g. there has been an open issue to implement setting runtimeClass on workload resources for three years.<p>- All of the options on the Terraform resources have been converted from camel-case to snake-case, which is fine except that I always forget to do that conversion when working off of the k8s API reference or an example. Some of them have also been converted from plural to singular.<p>- Because of the heavy use of Terraform blocks for configuring resources, it&#x27;s often annoying to reuse chunks of configuration across resources or use non-trivial variables in the configuration -- and that&#x27;s the big reason I wanted to use something like Terraform (versus flux or similar) in the first place.<p>- The k8s provider does actually have a way to manage custom resources now, the kubernetes_manifest resource type, but it requires writing the whole resource manifest out in HCL.<p>In short, there are better approaches and I would recommend against it. But hey, I&#x27;m just some guy on the internet.
avbanks超过 2 年前
When you say &quot;Kubernetes service provisioning&quot; I&#x27;m assuming you mean Kubernetes application provisioning (k8s manifest)? But I&#x27;d be cautious of using Terraform to deploy k8&#x27;s applications, it can be done but it has some drawbacks. One of the biggest issues is around interpolating k8s credentials in the provider config (you can google this for more details).<p>&quot;When using interpolation to pass credentials to the Kubernetes provider from other resources, these resources SHOULD NOT be created in the same Terraform module where Kubernetes provider resources are also used . This will lead to intermittent and unpredictable errors which are hard to debug and diagnose. The root issue lies with the order in which Terraform itself evaluates the provider blocks vs. actual resources.&quot;<p>I&#x27;d recommend some solution such as argocd, flux, or if you&#x27;re using a cloud provider such as azure they have automated deployments for k8s applications onto clusters (I&#x27;m sure aws has something similar).
awithrow超过 2 年前
Last I checked, the kubernetes provider didn&#x27;t support CRDs or custom resources. Its pretty common to have various operators running in a cluster so you&#x27;d need a different way to manage these. I usually provision clusters with Terraform and then use some other tool like flux&#x2F;argo to deploy manifests managed with either helm or kustomize
评论 #33665198 未加载
aynawn超过 2 年前
See the aws-ia official eks-blueprints repo. They have a ton of modules that reuse their helm-addon and irsa modules. Adding the aws-load-balancer-controller, for instance, is a single boolean.<p><a href="https:&#x2F;&#x2F;aws.amazon.com&#x2F;blogs&#x2F;containers&#x2F;bootstrapping-clusters-with-eks-blueprints&#x2F;" rel="nofollow">https:&#x2F;&#x2F;aws.amazon.com&#x2F;blogs&#x2F;containers&#x2F;bootstrapping-cluste...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;aws-ia&#x2F;terraform-aws-eks-blueprints&#x2F;tree&#x2F;main&#x2F;modules&#x2F;kubernetes-addons" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aws-ia&#x2F;terraform-aws-eks-blueprints&#x2F;tree&#x2F;...</a>