It seems to me like Terraform is good at describing desired deployment shapes and detecting drift between actual state and desired state.
Can someone clue me into why Terraform hasn't caught on as the abstraction above/that drives K8S?
It seems to me like Terraform is good at describing desired deployment shapes and detecting drift between actual state and desired state.
Can someone clue me into why Terraform hasn't caught on as the abstraction above/that drives K8S?
The issue with Kubernetes is more expressing the state. Kube uses YAML, which quickly becomes verbose and hard to maintain. More on our blogpost: https://grafana.com/blog/2020/01/09/introducing-tanka-our-wa...
Tanka is trying to solve this issue by providing a more powerful language that overcomes these limitations hopefully.
We ended up using TF's Helm provider, sometimes with hacks like a helm chart which deploys an arbitrary YAML file (the so-called "raw" chart). At that point, Terraform is blind to what's actually happening inside K8S. You can still benefit from the ability of TF to pass data from your other infra automation into the Helm charts, of course, but it's really Helm actually managing the configuration of your K8S cluster. And that's the app we all love to hate.
The situation may have been improved, but my conclusion was that it would always be a somewhat incomplete interface.
For those things we use a direct kubectl yaml provider.
I wish there was an istio provider!
There is a bit of a movement, however, behind using it to deploy software by pairing it with Packer. You use Packer to create an e.g. AMI whose sole job it is to run your software (like a Docker container) then use Terraform to launch a bunch of EC2 instances that have juuuust enough resources to effectively run your software. That'd allow you to eliminate k8s from your stack, though it remains to be seen which stack would be more cost-efficient to run on.
I have about 40 kubernetes services all as modules using the kubernetes terraform provider. I think I have 1000+ pods running on our one cluster all deployed through terraform.
It works very well because I can chain infrastructure resources into my service deployments. For example, I can create a dynamically named bucket and pass the name of that bucket as configmap/secret into my service to use.