Kubernetes deployments and services

Greetings, and good morning.

I am really struggling with these yaml files. Format, spacing, what is really needed what should be in them what is better to put in them like more descriptive labels etc. every time i try to stray from a very generic sample stuff goes wonky. I really need a really good resource on the pieces and parts and proper layout of deployment files in Kubernetes. i have lots of samples but i would love to see something that explains a good sample as to why each piece is there. As well as spacing. I keep having issues with that

2 Likes

Hi CRG,

First off, youā€™re not alone. Wrangling YAML and understanding the complicated domain models are the hardest parts of mastering Kubernetes. To understand what each field is for, you should get used to running kubectl explain. It describes each object, and all of their fields, and often lists valid values. You can give it the --recursive flag to see the entire tree of fields for an object, and you can drill into a specific field or subtree by running kubectl explain deployment.spec.strategy.

For YAML formatting, you should look into ways of configuring your editor to help you out. I use vim, which has great yaml support, built in. Thereā€™s also a lot of good YAML linters, which can validate your syntax, and thereā€™s the https://github.com/garethr/kubeval project, which does that explicitly for Kubernetes.

Best of luck!

1 Like

Hey.

Iā€™m running in the same wagon. My focus is mainly on versioning and ease of modification (upgrading groups of services or all at once without going to every single deployment descriptor). Right now there seems to be huge number of solution, each doing itā€™s job in a bit different way. I would like to avoid using Helm is it does not fit our use cases very well.

Iā€™m currently watching how Ksonnet and Kapitan are evolving and it is looking promising. With help with something [kube-applier](like https://github.com/box/kube-applier) could provide complete solution Iā€™m looking for.

Most recent find: Argo-CD :eyes: