Live data from Hacker News

Deploying Kubernetes with Ansible

erichreich.com

21–30 of 61 posts

Re: Deploying Kubernetes with Ansible

#21
post #4

I think the lesson people need to start taking is that any form of declarative form of configuration will spawn an ad-hoc ecosystem to turn it imperative. The complexity of situations that can be expressed is by a configuration system is proportional to the complexity of that system. Simple and declarative is an oxymoron for anything but simple cases. Imperative systems can express arbitrary complexity and you will n…

The lesson is that shockingly few people have realized is that the problem space is not, nor has it ever been, served by declarative solutions. You can describe the state you want a system to be in but there will inevitably be procedures involved to do some of the work. It is unavoidable . At the point people began developing templating around their configuration, ah, templates... which themselves have imperative lan…

Do you have any examples of deploying to Kubernetes with something you consider real tools? I agree with what you are saying but have found very few real world companies using real languages for this.

Re: Deploying Kubernetes with Ansible

#22
post #21

Earlier quoted context omitted.

The lesson is that shockingly few people have realized is that the problem space is not, nor has it ever been, served by declarative solutions. You can describe the state you want a system to be in but there will inevitably be procedures involved to do some of the work. It is unavoidable . At the point people began developing templating around their configuration, ah, templates... which themselves have imperative lan…

Do you have any examples of deploying to Kubernetes with something you consider real tools? I agree with what you are saying but have found very few real world companies using real languages for this.

At work we use typescript to generate yaml files which are then synced to their respective clusters via Gitops. It works fairly well. All cluster/namespace differences are encoded into our typescript code base, so we can take advantage of a real programming language to generate cluster specific yaml all sharing a common “base”.

Re: Deploying Kubernetes with Ansible

#24
post #20
post #5

Earlier quoted context omitted.

The problem is when you're in a situation where "over here we need YAML document A, and over there we need YAML document B." You either shove a templating system in front of your YAML and fight with that or throw in the towel just use a programming language where constructs in your YAML map to objects.

I think we need to burn this whole thing down and rethink it at this point. A huge amount of the total operational cost of our business is working around weird YAML problems and helm charts. Had one a while back where quoted strings containing padded numbers in were used for something. "01" fine ... "05" fine, "06" fine, "07" fine, "08" kaboom. 01-07 were treated as strings and 08 was suddenly being treated as octal,…

Helm is a pile of garbage. k8s speaks JSON just fine as expected.

Try Tanka + Jsonnet to restore some of your sanity, also allows you to keep using Helm during your transition to a better place.

Re: Deploying Kubernetes with Ansible

#25
post #24
post #20

Earlier quoted context omitted.

I think we need to burn this whole thing down and rethink it at this point. A huge amount of the total operational cost of our business is working around weird YAML problems and helm charts. Had one a while back where quoted strings containing padded numbers in were used for something. "01" fine ... "05" fine, "06" fine, "07" fine, "08" kaboom. 01-07 were treated as strings and 08 was suddenly being treated as octal,…

Helm is a pile of garbage. k8s speaks JSON just fine as expected. Try Tanka + Jsonnet to restore some of your sanity, also allows you to keep using Helm during your transition to a better place.

This is just the same problem in JSON, another loose schema’ed mess. Got my fair share of problems with that at the moment as well.

Re: Deploying Kubernetes with Ansible

#26
post #25
post #24

Earlier quoted context omitted.

Helm is a pile of garbage. k8s speaks JSON just fine as expected. Try Tanka + Jsonnet to restore some of your sanity, also allows you to keep using Helm during your transition to a better place.

This is just the same problem in JSON, another loose schema’ed mess. Got my fair share of problems with that at the moment as well.

If you feel really strongly about getting type safety then there is Pulumi + Typescript though I really hate how it tries to be a "better" kubectl apply and fails miserably.

Definitely room for someone to make something better than Helm but I think you should give Jsonnet a shot if you haven't already.

Re: Deploying Kubernetes with Ansible

#28
Gosh, I wish the author wouldn't sound so arrogant presenting me his reinvented wheel.

What your Ansible is doing (looping over the inventory, imperatively executing tasks) is reinventing what a Kubernetes-internal Operator is doing after you asked it to reconcile your changes. Thing is: You're not only reinventing the internal thing, you will eventually recreate internal logic, e.g. some internal dependencies and knowledge "what to do in which order". Good luck with further developments on the Kubernetes upstream. Not cool.

Kubernetes does what it can, to give the user a declarative DX. You might not want to fight this. kustomize and some _trivial_ scripting is usually all you'll need. If you need more, consider writing custom Operators.

Re: Deploying Kubernetes with Ansible

#30

Gosh, I wish the author wouldn't sound so arrogant presenting me his reinvented wheel. What your Ansible is doing (looping over the inventory, imperatively executing tasks) is reinventing what a Kubernetes-internal Operator is doing after you asked it to reconcile your changes. Thing is: You're not only reinventing the internal thing, you will eventually recreate internal logic, e.g. some internal dependencies and kn…

> kustomize and some _trivial_ scripting is usually all you'll need.

So not just k8s alone, k8s + kustomize, no Helm charts, right?

or can you do k8s + Helm, no kustomize?

or can you do kustomize to deploy Helm charts which abstracts away and translates to underlying k8s API calls/generated YAML?

Post reply on HN