5 ms·
kubectl apply on a directory full of yaml works fairly well for small stuff. Check it into git and it's version controlled. If you need something more flexibl
by kube-system 4y ago
kubectl apply on a directory full of yaml works fairly well for small stuff. Check it into git and it's version controlled.
If you need something more flexible than that, try making your own helm chart. Helm will give you some text templating, pre and post hooks, some basic functions, and some versioning and rollback functionality.
You can start simple by just pasting in your existing k8s yaml, and then just pull out the pieces you need into variables in your values file. If you need to change an image version, then you just update the variable and `helm upgrade mychart ./mychart`
- throwaway894345 4y agokubectl apply on a directory doesn’t work because deleting a resource manifest won’t delete the corresponding resources.
- bavell 4y ago'kubectl delete -f dir/' will delete all resources in the directory.
- throwaway894345 4y agoRight, but the only resource you want to delete is no longer in that directory, so you’ve now deleted every resource you except the one you actually wanted to delete. :)
- bavell 4y agoAh, I slightly misunderstood. Still, you should always have your manifests under version control so this shouldn't ever be a problem :)
- kube-system 4y agoIt does work, as long as you’re not deleting anything. :) That might be good enough for a “very small kube cluster for my hobby project” I only use ‘kubectl apply’ for small stuff where I only have a couple resources. Anything more complicated and a tool like helm is much more useful.