by arianvanp · 4y ago · 0 comments
I'd say `kubectl apply` fits better with a Git oriented flow than the imperative `helm install` flow. Nothing about helm guarantees or forces you to use version control. Actually the opposite. If `helm install` fails. You need to `helm delete` first. It has no way of declaratively managing updates at all.
Have a CI job call `kubectl apply -k ./deploy --prune` on every commit is way nicer than helm in my opinion.
There's a lot of valid complaints floating around YAML but what's worse than dealing with YAML is dealing with templated YAML.
kubectl brings everything to the surface. Helm is an unnecessary abstraction.
If you need this templating, a think you can do is use helm for that but not for install/deployment: render the charts with `helm template` and then apply them with `kubectl apply` and/or verify the changes with `kubectl diff`.
IIRC Argo CD can show you the differences between the running helm chart and the new version you want to apply if you haven't enabled automated syncing, but I only use Argo CD with Kustomize, so I can't say for sure right now.
edit: by reading the article again I think the spirit of that point is not 'use just helm' but 'don't apply stuff directly'. Long term, if there's more than one person working in Kubernetes, that's prone to failure and configuration drift. Doing the templating in whatever language or system that fills your needs and then using something like Argo CD or Octopus to apply them can remove most of those problems.
Yep, this is what I meant! Just "if you're using some kind of manager for your resources, which you probably are, then ONLY use that manager, don't just `apply` stuff out of band" is the idea :)
I might take a pass later at making that more clear
I don't want complexity in my manifests. I want them to be to the point.
Renaming in multiple places is very easy with find-replace.
It also allows to calculate a checksum for a config map which then triggers a restart of a deployment.
It allows to do a proper release do to working conventions.
It also makes it easy to pull out configuration options.
I think kubectl apply is the worst option.
- kubectl apply -k ./deploy --prune
- heml install
- helm template + kubectl apply + kubectl diff
- Kustomize
- Argo CD
- Octopus
- JSONNet
- Cue
- Pulumi
And because this is an advanced topic (most of the above require a large investment reading docs and github issues), I'm guessing many/most people never get beyond ad-hoc kubectl commands and letting their cluster run wild.Whenever I can, I use helmfile[0] for storing variables for helm since it does add a declarative layer on top of helm.