-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
157 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<# | ||
.SYNOPSIS | ||
Install modules. | ||
.DESCRIPTION | ||
Install modules. | ||
#> | ||
[CmdletBinding()] | ||
Param( | ||
) | ||
$Script:ErrorActionPreference = 'Stop' | ||
Set-StrictMode -Version Latest | ||
trap { throw $Error[0] } | ||
if (-not $MyInvocation.BoundParameters.ContainsKey('Verbose')) { | ||
$VerbosePreference = [System.Management.Automation.ActionPreference]::Continue | ||
} | ||
$ScriptRoot = $PSScriptRoot | ||
# | ||
# Get shared variables. | ||
. "$PSScriptRoot\_Shared.ps1" | ||
# | ||
Write-Verbose 'Installing modules...' | ||
$Command = "docker container run --mount 'type=bind,source=$DockerMountSource,destination=$DockerMountDestination'" + | ||
" --workdir '$DockerMountDestination' --rm --env 'BOLT_PROJECT=$DockerMountDestination' '$BoltDockerImage'" + | ||
" module install --force" | ||
Write-Verbose $Command | ||
Invoke-Expression $Command | ||
if ($LASTEXITCODE -ne 0) { | ||
throw "This command failed with exit code ${LASTEXITCODE}: $Command" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,65 @@ | ||
# test-voxpupuli-puppet-k8s | ||
|
||
- .gitignore: from a Bolt project created following https://www.puppet.com/docs/bolt/latest/bolt_installing_modules.html. | ||
- Provision CentOS 9 VMs. | ||
- Configure `local.yaml` for your environment. | ||
- Install modules by running this command: | ||
``` | ||
bolt module install --force | ||
``` | ||
On Windows, you can run: | ||
``` | ||
.\InstallModules.ps1 | ||
``` | ||
- On one of the VM, provision controller by running this command: | ||
``` | ||
bolt plan run test_voxpupuli_puppet_k8s::myplan --targets <VmHostname> --user <VmUsername> --password <VmPassword> --inventory inventory.yaml node_type=controller | ||
``` | ||
On Windows, you can run: | ||
``` | ||
.\Build.ps1 -Target <VmHostnames> -User <VmUsername> -Pass <VmPassword> -NodeType controller | ||
``` | ||
It should fails with this error: | ||
``` | ||
Err: /Stage[main]/K8s::Server::Resources::Bootstrap/Kubectl_apply[puppet:cluster-info:reader Role]: Could not evaluate: Execution of '/bin/kubectl --namespace kube-system --kubeconfig /root/.kube/config get Role puppet:cluster-info:reader --output json' returned 1: error: the server doesn't have a resource type "Role" | ||
``` | ||
Run the same command a second time, and it should succeed. | ||
- On one of the controller VM, copy /root/.kube/config and save it into ~/.kube/config. Eg: | ||
``` | ||
mkdir -p $HOME/.kube | ||
sudo cp -i /root/.kube/config $HOME/.kube/config | ||
sudo chown $(id -u):$(id -g) $HOME/.kube/config | ||
``` | ||
- Check Kubernetes namespaces by running this commands: | ||
``` | ||
kubectl get namespaces | ||
``` | ||
It should list something like this: | ||
``` | ||
NAME STATUS AGE | ||
default Active 20m | ||
kube-node-lease Active 20m | ||
kube-public Active 20m | ||
kube-system Active 20m | ||
``` | ||
- On the other VMs, provision worker by running this command: | ||
``` | ||
bolt plan run test_voxpupuli_puppet_k8s::myplan --targets <VmHostname> --user <VmUsername> --password <VmPassword> --inventory inventory.yaml node_type=worker | ||
``` | ||
``` | ||
On Windows, you can run: | ||
``` | ||
.\Build.ps1 -Target <VmHostnames> -User <VmUsername> -Pass <VmPassword> -NodeType worker | ||
``` | ||
- On the same controller VM as above: | ||
- Check Kubernetes nodes by running this commands: | ||
``` | ||
kubectl get nodes | ||
``` | ||
It should list something like this: | ||
``` | ||
NAME STATUS ROLES AGE VERSION | ||
<workerFqdn> Ready <none> 5h29m v1.26.1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# The Puppet Bolt image: | ||
$BoltDockerImage = 'puppet/puppet-bolt:3.27.4' | ||
# Project names can contain only lowercase letters, numbers, and underscores, and begin with a lowercase letter. | ||
$BoltProjectName = 'test_voxpupuli_puppet_k8s' | ||
$DockerMountDestination = "/$BoltProjectName" | ||
# Mount source must be an absolute path. | ||
$DockerMountSource = $PSScriptRoot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
--- | ||
version: 5 | ||
#hierarchy: | ||
# - name: Common | ||
# path: common.yaml | ||
#defaults: | ||
# data_hash: yaml_data | ||
# datadir: data | ||
hierarchy: | ||
- name: Per node type data | ||
path: nodes/%{node_type}.yaml | ||
- name: Common | ||
path: common.yaml | ||
defaults: | ||
data_hash: yaml_data | ||
datadir: data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters