4 ms·
As a relatively new Kubernetes user, the big thing on my wishlist is templates (for example so I can share YAML between my production and staging environments).
by scjody 9y ago
As a relatively new Kubernetes user, the big thing on my wishlist is templates (for example so I can share YAML between my production and staging environments). Unfortunately the k8s team have already said "no" to that, and point to a list of alternatives. But without a simple solution that lots of people use, it's hard to know which one to pick and it doesn't look like any are particularly good. I took a quick look at a bunch of them and they seem to be either half-baked solutions that someone put up on GitHub, or tools that introduce way more complexity than I need right now (like Helm).
- deleted 9y ago[deleted]
- donaldguy 9y agohelm recently(ish) added a helm template command to do client side rendering of a chart So if you wanted to just create a folder with a Chart.yaml, and a templates/file.yml.tpl with some `{{.Values.foo}}` template strings It is sufficient to just run `helm template --set foo=bar | kubectl apply -f -` at that point. Idk if that is little enough complexity for you. Similarly I use https://github.com/gliderlabs/sigil https://github.com/gliderlabs/sigil a few places where I want to include specific fields from external json files
- linkmotif 9y agoSame here, helm template is great. It’s nice to pipe output from helm template to https://github.com/dminkovsky/kube-cloud-build https://github.com/dminkovsky/kube-cloud-build if you’re on GKE. If you’re using helm, is your json interpolation for things that can’t be in values.yaml?
- donaldguy 9y agoBut if you don't love YAML itself you might just wanna check out ksonnet: https://ksonnet.io/ https://ksonnet.io/
- nameless912 9y agoI just hacked together a solution using Jinja2. I literally throw template strings in whatever fields I need templated and render the whole thing to /tmp/ using a stupid simple python script. It's not pretty, and admittedly it's a little fragile and home spun, but it works.
- scjody 9y agoI'll probably end up doing the same. For now we're just duplicating things in two places.
- web007 9y agoYou can use any templating system you like, then "| kubectl create -f -" I would like YAML includes, or some way to re-use templates directly. It's mildly inconvenient to have all of my env vars templated, but to require N copies for N variants on runcommand / base name / port / etc. I could Xzibit templates in my templates I suppose, by having a simpler format than YAML with #include would be awesome.
- linkmotif 9y agoHelm is a lot simpler than it looks, and it’s awesome. I also had this exact perspective, not wanting to introduce more complexity and therefore held off on Helm for a long time. But then I got comfortable enough with Kubertnes and also my project got complex enough that I needed templating and then Helm was great to pick up. I just use one chart that I wrote for my application and I don’t mess around with repositories. I render the chart locally with helm template[0] to build my containers on Google Cloud container builder[1]. Then I deploy with helm upgrade. It’s a great flow! [0]https://github.com/technosophos/helm-template https://github.com/technosophos/helm-template [1]https://github.com/dminkovsky/kube-cloud-build https://github.com/dminkovsky/kube-cloud-build
- bogomipz 9y agoI've really confused by Helm. From their github repo Helm bills itself as: "The Kubernetes package manager." Then it goes on to state: "Helm is a tool for managing Kubernetes charts." Then reading further I see: "Charts are packages of pre-configured Kubernetes resources." I find this extremely confusing. Also its my understanding that unit of deploy in K8 is a pod which is built on Docker containers. Isn't installing packages into running containers considered an anti-pattern? Could someone give a better explanation of Helm/Charts and when someone might use it?
- linkmotif 9y agoYeah it’s not the best docs. But the tool is great. Helm just renders a bunch of templates of kubernetes manifests against a values file. It then takes the resulting manifests, compares them to what’s running on your cluster and makes sure nothing less or more is running. That’s it. What’s nice about it is that you can then change the manifest templates or values files, and when you install the updated result, you have a single concrete new state that your entire application is in. Which makes it easy to version your entire application, whether you changed just one env var in one manifest or made many changes thoughout. There’s a package manager component but you can skip that completely and imo it’s just confusing that they lead front and center with that component. The essential commands are helm ls and helm upgrade. And helm rollback is nice too.
- lobster_johnson 9y agoYou can use Helm with local files, instead of fiddling with the awkward "repository" concept: helm install . We use this to wrap Helm with a nice deployment tool that does a lot more (e.g. automatically annotate our resources with git commit information).