Rex-Rancher

 view release on metacpan or  search on metacpan

lib/Rex/Rancher.pm  view on Meta::CPAN

a running CNI and GPU device plugin.

GPU support is optional. Pass C<gpu =E<gt> 1> and install L<Rex::GPU>
separately. Rex::Rancher works identically for non-GPU nodes.

When deploying a GPU server node, the full pipeline runs automatically:

=over

=item 1. B<Node preparation> — hostname, timezone, locale, NTP, swap off,
kernel modules (br_netfilter, overlay), sysctl for Kubernetes networking.

=item 2. B<GPU setup> (C<gpu =E<gt> 1>) — NVIDIA driver via DKMS, optional
reboot, Container Toolkit, CDI specs, containerd runtime config. Handled by
L<Rex::GPU>.

=item 3. B<Cluster bring-up> — write config, run RKE2 or K3s install script,
wait for kubeconfig file on the remote host, fetch and save it locally,
wait for API server readiness via L<Kubernetes::REST>.

=item 4. B<Cilium CNI> — Cilium CLI installed on the remote host, Cilium

lib/Rex/Rancher/Node.pm  view on Meta::CPAN


sub _disable_swap {
  Rex::Logger::info("Disabling swap");
  run "swapoff -a", auto_die => 0;
  delete_lines_matching "/etc/fstab", matching => qr/\sswap\s/;
}

sub _load_kernel_modules {
  Rex::Logger::info("Loading required kernel modules");
  run "modprobe br_netfilter", auto_die => 0;
  run "modprobe overlay", auto_die => 0;
  file "/etc/modules-load.d/kubernetes.conf", content => "br_netfilter\noverlay\n";
}

sub _configure_sysctl {
  Rex::Logger::info("Configuring kernel parameters for Kubernetes");
  file "/etc/sysctl.d/99-kubernetes.conf",
    content => join("\n",
      "net.bridge.bridge-nf-call-iptables = 1",
      "net.bridge.bridge-nf-call-ip6tables = 1",
      "net.ipv4.ip_forward = 1",
    ) . "\n";

lib/Rex/Rancher/Node.pm  view on Meta::CPAN

openSUSE Leap.

The module sets OS-level configuration that Kubernetes requires:

=over

=item * B<Swap disabled> — Kubernetes does not function correctly with swap
enabled.

=item * B<Kernel modules> — C<br_netfilter> is needed for iptables to see
bridged traffic; C<overlay> is required for containerd's overlay filesystem.

=item * B<Sysctl parameters> — IP forwarding and bridge netfilter settings
required by Kubernetes networking and CNI plugins.

=item * B<NTP> — Time skew between nodes causes certificate validation
failures and etcd instability. C<chrony> is installed and started.

=back

Called automatically by L<Rex::Rancher/rancher_deploy_server> and

lib/Rex/Rancher/Node.pm  view on Meta::CPAN

=item * Add FQDN entry to C</etc/hosts> (when both C<hostname> and C<domain> given)

=item * Set timezone via C<timedatectl> or symlink (default: C<UTC>)

=item * Set locale via C<localectl> or C</etc/default/locale> (default: C<en_US.UTF-8>)

=item * Install and start C<chrony> for NTP synchronisation (default: enabled)

=item * Disable and remove swap entries from C</etc/fstab>

=item * Load C<br_netfilter> and C<overlay> kernel modules and persist to
C</etc/modules-load.d/kubernetes.conf>

=item * Write C</etc/sysctl.d/99-kubernetes.conf> with C<net.ipv4.ip_forward>,
C<net.bridge.bridge-nf-call-iptables>, and C<net.bridge.bridge-nf-call-ip6tables>,
then apply with C<sysctl --system>

=back

  prepare_node(
    hostname => 'worker-01',      # optional — short hostname



( run in 1.467 second using v1.01-cache-2.11-cpan-39bf76dae61 )