Skip to content

Conversation

@bobsira
Copy link
Contributor

@bobsira bobsira commented Oct 12, 2023

This pull request introduces several significant changes aimed at enhancing automation scripts for setting up and managing Minikube clusters with Windows nodes. Key updates include the addition of new PowerShell modules for managing tools like Containerd, NSSM, and Minikube, as well as improvements to the setup and run scripts for better orchestration of virtual machines and Kubernetes components.

Enhancements to Automation Scripts:

New PowerShell Modules:

  • automation/ContainerdTools.psm1: Introduced functions to manage Containerd, including installation, initialization, service management, and uninstallation. These functions streamline the setup of Containerd for Kubernetes clusters.
  • automation/NSSMTools.psm1: Added a function to install NSSM (Non-Sucking Service Manager), ensuring it is available for managing services on Windows nodes.
  • automation/MinikubeTools.psm1: Added functions to handle Minikube-specific tasks, such as generating Kubernetes join commands, managing folder errors, and updating the hosts file.

Setup and Configuration Improvements:

  • automation/SetUp.ps1: Enhanced the setup script to automate the creation and configuration of a virtual machine, including starting the VM, waiting for readiness, and verifying the installation of Windows. It also integrates the Run.ps1 script for further configuration.
  • automation/Run.ps1: Added a comprehensive orchestration script to set up a Minikube cluster, configure Flannel CNI, prepare Linux and Windows nodes, and join the Windows node to the Kubernetes cluster. It also applies necessary configurations for Flannel and kube-proxy on the Windows node.

Documentation Update:

  • README.md: Updated the instructions for retrieving the Minikube master node IP address, replacing minikube node list with minikube ip for accuracy.This pull request introduces significant enhancements to the automation scripts for setting up and managing a Kubernetes cluster with Minikube on Windows. The changes include new PowerShell modules for managing containerd, NSSM, and Minikube, as well as updates to the setup and execution scripts to streamline the cluster creation and configuration process. Additionally, the documentation has been updated to correct a command.

Documentation Update:

  • Updated the README.md to replace the outdated minikube node list command with the correct minikube ip command for retrieving the master node's IP address.

New PowerShell Modules:

  • Containerd Tools (automation/ContainerdTools.psm1):
    • Added functions to manage containerd, including installation, service initialization, configuration, and uninstallation.
  • Minikube Tools (automation/MinikubeTools.psm1):
    • Added functions to generate Kubernetes join commands, handle Minikube folder errors, and update the hosts file.
  • NSSM Tools (automation/NSSMTools.psm1):
    • Added a function to install NSSM (Non-Sucking Service Manager) for service management.

Automation Enhancements:

  • Run Script (automation/Run.ps1):
    • Added a comprehensive script to automate the creation and configuration of a Minikube cluster, including installing containerd, configuring Flannel CNI, and joining Windows nodes to the cluster.
  • Setup Script (automation/SetUp.ps1):
    • Added a script to set up a virtual machine, install Windows, and invoke the Run.ps1 script to configure the Kubernetes cluster.To test this PR you require a windows VM running Windows Server 2022. I've shared a quick guide to setup such a VM at the last bit.

Here's how you test this work:

  1. Open a PowerShell Window as Administator .
  2. Navigate to the automation directory
cd automation
  1. Run the following command
.\SetUp.ps1 -ISOFilePath "YourISOFilePath" -VMName "minikube-ws22" -UserName "Administrator" -Pass "Minikube@2024"

Replace 'YourISOFilePath', with the actual values.

There is an optional parameter, $KubernetesVersion which you can pass or the latest Kubernetes version will be used for your configuration

You should expect the following output

kalki-kubes

Clean Up Steps

kubectl get nodes
kubectl drain minikube-ws22 --ignore-daemonsets --delete-local-data
kubectl delete node minikube-ws22
minikube delete --all
$VMName = 'minikube-ws22'
Stop-VM -Name $VMName -TurnOff
Remove-VM -Name $VMName -Force
Remove-Item -Path ${env:homepath}\.minikube\machines\$VMName -Force -Recurse

@bobsira bobsira marked this pull request as ready for review October 31, 2023 09:51
@vrapolinario
Copy link
Owner

Thanks for the contributions @bobsira. Let me know when this PR is ready for review.

param (
[String]
[ValidateNotNullOrEmpty()]
$SwitchName = 'External VM Switch'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why external switch? Are there any issues with using internal switch?

@bobsira bobsira force-pushed the user/bosira/remote-powershell-script branch from b188f74 to 8398aef Compare November 4, 2024 00:22
@mloskot
Copy link

mloskot commented Dec 14, 2025

@bobsira @vrapolinario Any plans to merge this?

@bobsira
Copy link
Contributor Author

bobsira commented Dec 16, 2025

@bobsira @vrapolinario Any plans to merge this?

We've implemented this work in minikube and just waiting for our work to be merged and released -> bobsira/minikube#4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamline the Windows node config with PowerShell remote

6 participants