Live data from Hacker News

Deploying Kubernetes with Ansible

erichreich.com

41–50 of 61 posts

Re: Deploying Kubernetes with Ansible

#41
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…

Imperative isn't really unavoidable, all imperative programs can be expressed as functional declarative programs which is much more natural to something that should be declarative in nature (I don't want to know everything you did to get/maintain your network.)

The problem is that people want to express functions as extensions to declarations in yaml, XML, etc, instead of in a functional language that is heavy on declaration.

Re: Deploying Kubernetes with Ansible

#42
I started with Ansible and k8s and.its.fine.

Not really hard, you get it up and running fast enough (who ever wants to setup a k8s cluster like this has the week to do so).

But honestly: don't!

I switched to rke2. Alternativly try out gardener from sap or anything else between Ansible and managed.

You do not want to take care of bare metal k8s.

And rke2 is still not perfect but it's rancher support will be better and better and more than just you are using it.

But be real: if you don't need air gap, go to a cloud provider.

Ah and btw open nebula also started supporting k8s by deploying rke2!

Re: Deploying Kubernetes with Ansible

#43

Earlier quoted context omitted.

> 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?

Hm take it with a grain of salt, but I'm not really a fan of Helm. It might make sense in some bigger corps where you have something like "Platform" teams with dozens of consuming teams to consolidate and version some kind of service. But I lack trust and frequently same-mindedness with Helm chart authors on how to deploy and configure certain things such that I'll use my own thingy anyway. I forgot to mention the CD…

couldn't agree more, but we are "stuck" in managed ansible + k8s

although i think kustomize wouldn't make a nicer picture than ansible, but push vs pull .. i prefer pull

Re: Deploying Kubernetes with Ansible

#44
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.

Pulumi, cdk8s.

Re: Deploying Kubernetes with Ansible

#45

I started with Ansible and k8s and.its.fine. Not really hard, you get it up and running fast enough (who ever wants to setup a k8s cluster like this has the week to do so). But honestly: don't! I switched to rke2. Alternativly try out gardener from sap or anything else between Ansible and managed. You do not want to take care of bare metal k8s. And rke2 is still not perfect but it's rancher support will be better and…

I don't think you read the article. It's about deploying resources onto k8s with ansible, not deploying or maintaining k8s.

Re: Deploying Kubernetes with Ansible

#46

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?

My preference is to use kustomize with argocd applicationsets.

If helm is how some application is distributed we just render the template with our values file and store that in git, even though argocd can also use helm charts. We'd just prefer to see the diff in git instead of argocd so the deployment is still automated.

Re: Deploying Kubernetes with Ansible

#47
post #45

I started with Ansible and k8s and.its.fine. Not really hard, you get it up and running fast enough (who ever wants to setup a k8s cluster like this has the week to do so). But honestly: don't! I switched to rke2. Alternativly try out gardener from sap or anything else between Ansible and managed. You do not want to take care of bare metal k8s. And rke2 is still not perfect but it's rancher support will be better and…

I don't think you read the article. It's about deploying resources onto k8s with ansible, not deploying or maintaining k8s.

Huh? Than that's even worse.

Use argocd or flux

Re: Deploying Kubernetes with Ansible

#50

I thought this was about deploying a Kubernetes cluster with Ansible, but nope, it's really about deploying YAML files to Kubernetes, with Ansible. Just...Why?

> Just...Why?

I can imagine some cases where you might want to setup infrastructure-related software on your cluster and to do so through Ansible (using manifests or Helm charts under the hood), so that you have one template that you can use for setting up clusters later, for various use cases. For example, you might want a custom ingress controller, or to deploy a service mesh like Istio, or maybe Kiali as well. Perhaps you want to launch Rancher on your cluster to give your engineers an arguably easier way to interact with the cluster, or to explore it in a more visual way than just using something like the kubectl CLI (though tools like k9s are great, too: https://k9scli.io/).

Edit: Many suggest that using something like Argo CD would be a better tool for this, due to its specialization, though.

I actually utilized a similar approach when working with Ansible + Docker Swarm (since I needed a more lightweight orchestrator that played nicely with Docker, but to manage the nodes with Ansible): I deployed my own "ingress" (just a web server container with some configuration), some supporting software like Sonatype Nexus for storing custom images, Portainer for graphic cluster management and some other software for similar concerns. Once that was done and other server configuration (e.g. user accounts, groups, permissions, folders, services etc.; though most less relevant for the containers themselves) were set up, other CI/CD pipelines could deploy apps across the cluster without Ansible being involved - but it was good for setting up the base for it all.

But if you wanted to use Ansible for deploying almost all of your apps, like in the article? I guess you could do that if you have a lot of buy-in into using Ansible and just prefer the way you do things with it. Admittedly, using Helm or one of the alternatives in this case might be a better choice.

Post reply on HN