The basic installation of operating systems and a foundational Kubernetes infrastructure with Calico CNI is carried out using Puppet and Foreman."
The modules used are as follows, some created as needed and others taken from the Puppet Forge repository:
Module using from puppet-forge:
puppetlabs-kubernetes version 8.0.0
puppetlabs-helm version 4.0.0 (Patched in baltig)
Module create purpose:
Il rgargana-helm_deploy_chart (in baltig)
rgargana-installer (in baltig)
The puppetlabs-kubernetes module requires an initial setup, as per the guide, to set some parameters common to both the control and worker nodes:
docker run --rm -v $(pwd):/mnt -e OS=redhat -e VERSION=1.23.7 -e CONTAINER_RUNTIME=docker -e CNI_PROVIDER=cilium -e CNI_PROVIDER_VERSION=1.9.0 -e ETCD_INITIAL_CLUSTER=plsparcdom001:192.168.109.100 -e ETCD_IP="%{networking.ip}" -e KUBE_API_ADVERTISE_ADDRESS="%{networking.ip}" -e INSTALL_DASHBOARD=true -e CNI_NETWORK_PROVIDER=https://raw.githubusercontent.com/cilium/cilium/v1.9/install/kubernetes/quick-install.yaml puppet/kubetool:6.2.0
The initialization phase, as seen from the command, requires a container manager installed on the Puppet server to generate two files:
- common.yaml (which contains all the keys for registering the workers)
- Redhat.yaml (The name depends on the variable in the previous command (OS=redhat) and is used to instantiate the K8s master/control node)
The generated files will be placed in the appropriate Puppet directory associated with the machine to be installed, for example:
/etc/puppetlabs/code/environments/<your environment>/data/common.yaml /etc/puppetlabs/code/environments/<your environment>/data/node/plsparcdom001.yaml (The name of your master is specified in the command)
Each variable specified in the two generated files can be rewritten by Foreman, based on Puppet's ENC paradigm.
nat and proxy
If the nodes are on a private network, they need to be NATED and also specify the master's/control's endpoints in no_proxy
Utils command
kubectl get node (test cluster) for i in `kubectl api-resources | awk '{print $1}'`; do kubectl get $i; done (show all resources)