kubernetes-sigs/kubespray

Add description of how to manage only Kubespray custom configuration in a separate git repository

Open

#10.645 aberto em 24 de nov. de 2023

Ver no GitHub
 (14 comments) (4 reactions) (1 assignee)HTML (4.419 forks)batch import
good first issuehelp wantedkind/featurelifecycle/frozen

Métricas do repositório

Stars
 (10.380 stars)
Métricas de merge de PR
 (Mesclagem média 25d) (26 fundiu PRs em 30d)

Description

What would you like to be added: Please add an official "best practices" instruction on how to manage the Kubespray configuration for a custom cluster in a separate git repository, with the minimum amount of files.

Why is this needed: Now a lot of instructions and articles about Kubespray recommend copying the whole directory inventory/sample to inventory/myclustername and doing the modifications of the needed options directly in these files.

Yes, this works well!

But, as a result, most of the users just adds this inventory/mycluster directory to the git, and upload all Kubespray folder to the git, producing a whole copy of Kubespray repo with a lot of files.

Even if some users are smart and store in a custom git repository files only from the inventory/mycluster directory, there are still a lot of files! Look:

./group_vars
./group_vars/k8s_cluster
./group_vars/k8s_cluster/k8s-net-macvlan.yml
./group_vars/k8s_cluster/k8s-net-kube-router.yml
./group_vars/k8s_cluster/k8s-cluster.yml
./group_vars/k8s_cluster/addons.yml
./group_vars/k8s_cluster/k8s-net-weave.yml
./group_vars/k8s_cluster/k8s-net-kube-ovn.yml
./group_vars/k8s_cluster/k8s-net-flannel.yml
./group_vars/k8s_cluster/k8s-net-custom-cni.yml
./group_vars/k8s_cluster/k8s-net-calico.yml
./group_vars/k8s_cluster/k8s-net-cilium.yml
./group_vars/etcd.yml
./group_vars/all
./group_vars/all/gcp.yml
./group_vars/all/openstack.yml
./group_vars/all/containerd.yml
./group_vars/all/azure.yml
./group_vars/all/vsphere.yml
./group_vars/all/oci.yml
./group_vars/all/upcloud.yml
./group_vars/all/aws.yml
./group_vars/all/offline.yml
./group_vars/all/cri-o.yml
./group_vars/all/etcd.yml
./group_vars/all/hcloud.yml
./group_vars/all/huaweicloud.yml
./group_vars/all/all.yml
./group_vars/all/coreos.yml
./group_vars/all/docker.yml
./patches
./patches/kube-scheduler+merge.yaml
./patches/kube-controller-manager+merge.yaml
./inventory.ini

Usually, users change only a couple of lines in the group_vars/k8s_cluster/k8s-cluster.yml from the default values, like:

cluster_name: mycluster.mydomain.com
supplementary_addresses_in_ssl_keys:
 - node1.mycluster.mydomain.com
 - node2.mycluster.mydomain.com

and in the group_vars/k8s_cluster/addons.yml:

helm_enabled: true
metrics_server_enabled: true

So, they can simply create a single file like mycluster-defaults-overrides.yml and just put these couple of changes here, and store only a single file with 6 lines in their custom git repo, and do not upload a hundredth copy of the whole "sample" directory to github.com, wasting the cloud storage space for nothing.

Moreover, a benefit of this approach will be a quick finding out what exact parameters were changed from defaults for this cluster, instead of digging into dozens of files to search which exact couple of lines were changed from defaults.

I created an example repository with a minimal template of the Kubespray configuration here: https://github.com/Murz-K8s/kubespray-inventory-base Feel free to discuss and improve it.

Guia do colaborador