M4: Difference between revisions

From Alteeve Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 69: Line 69:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cat ~/.kcli/config.yml  
cat ~/openshift-config.yml  
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang="yaml">
<syntaxhighlight lang="yaml">
default:
info: Madi's Test Plan on os-02
  autostart: false
cluster: mk-anvil-02
  client: local
domain: 'digimer.ca'
  cloudinit: true
version: stable
  cpuhotplug: false
tag: 4.19
  cpumodel: host-model
ctlplanes: 3
  diskinterface: virtio
workers: 3
  disks:
memory: 16384
  - default: true
numcpus: 16
    size: 20
pull_secret: /home/digimer/pull-secret.txt
  disksize: 20
</syntaxhighlight>
  diskthin: true
 
  enableroot: true
Make sure there's a key for root and for the user running 'kcli';
  guestagent: true
 
  guestid: guestrhel764
<syntaxhighlight lang="bash">
  host: 127.0.0.1
if [ -e ~/.ssh/id_ed25519.pub ]; then echo key exists; else echo key needed; ssh-keygen -f ~/.ssh/id_ed25519 -P ""; fi
  insecure: true
</syntaxhighlight>
  keep_networks: false
 
  memory: 2048
<syntaxhighlight lang="bash">
  memoryhotplug: false
sudo kcli create kube openshift --paramfile ~/openshift-config.yml mk-anvil-02
  nested: true
</syntaxhighlight>
  nets:
<syntaxhighlight lang="text">
  - default
Deploying on client local
  networkwait: 0
Deploying cluster mk-anvil-02
  notify: false
Using stable version
  notifymethods:
Using 192.168.255.253 as api_ip
  - pushbullet
Downloading openshift-install from https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable-4.19
  numcpus: 4
Move downloaded openshift-install somewhere in your PATH if you want to reuse it
  pool: default
Using installer version 4.19.7
  privatekey: false
Grabbing image rhcos-9.6.20250523-0-openstack.x86_64.qcow2 from url https://rhcos.mirror.openshift.com/art/storage/prod/streams/rhel-9.6/builds/9.6.20250523-0/x86_64/rhcos-9.6.20250523-0-openstack.x86_64.qcow2.gz
  protocol: ssh
   % Total    % Received % Xferd  Average Speed   Time    Time    Time  Current
  reservedns: false
                                Dload  Upload   Total   Spent    Left  Speed
  reservehost: false
40 1196M   40  480M    0    0  25.6M      0  0:00:46  0:00:18  0:00:28 25.7M
  reserveip: false
....
  rhnregister: true
  rhnserver: https://subscription.rhsm.redhat.com
  rhnunregister: false
  rng: false
  sharedkey: false
  start: true
  storemetadata: false
  tempkey: false
  tpm: false
  tunnel: false
  tunneldir: /var/www/html
   tunnelport: 22
   tunneluser: root
   type: kvm
   user: root
   vmrules_strict: false
  vnc: true
  wait: false
  waittimeout: 0
local:
  host: 127.0.0.1
  pool: default
  protocol: ssh
  type: kvm
  user: root
</syntaxhighlight>
</syntaxhighlight>


Go have a coffee or a nap, this will take a while...
More info;
<syntaxhighlight lang="bash">
https://kcli.readthedocs.io/en/latest/#openshift-cluster-creation
vim mytest.yml
kcli create kube openshift --paramfile mytest.yml mk-anvil-01
</syntaxhighlight>




Line 140: Line 124:
</syntaxhighlight>
</syntaxhighlight>


== Notes ==
= Notes =


* Bare iron OS is hardly relevant, it gets rebuilt.
* Bare iron OS is hardly relevant, it gets rebuilt.
Line 218: Line 202:
   vms: {{ cluster|kubenodes(ctlplanes, workers) }}
   vms: {{ cluster|kubenodes(ctlplanes, workers) }}
</syntaxhighlight>
</syntaxhighlight>


= References =
= References =

Latest revision as of 05:36, 3 September 2025

 Alteeve Wiki :: How To :: M4

Warning: This is little more than a collection of notes at this point. Do not consider anything here to be complete or accurate.

How to build an offline/ait-gapped, minimal, highly available Open Shift cluster.

Setting Up A Test Environment

This is a guide to setting up a bare iron machine to run open shift and kcli.

Install

whoami
# digimer
sudo dnf -y install libvirt libvirt-daemon-driver-qemu qemu-kvm tar
sudo usermod -aG qemu,libvirt $(id -un)
sudo newgrp libvirt
sudo systemctl enable --now libvirtd
sudo dnf -y copr enable karmab/kcli

sudo dnf -y install kcli </syntaxhighlight>

Configure

sudo kcli create pool -p /var/lib/libvirt/images default
Creating pool default...
sudo setfacl -m u:$(id -un):rwx /var/lib/libvirt/images
sudo virsh net-destroy default
Network default destroyed
sudo virsh net-undefine default
Network default has been undefined
kcli create network  -c 192.168.0.0/16 default
Network default deployed

Create the config;

kcli create host kvm -H 127.0.0.1 local
Using local as hostname
Host local created
Note: Use 'pull-secret', not rhn stuff.
cat ~/openshift-config.yml
info: Madi's Test Plan on os-02
cluster: mk-anvil-02
domain: 'digimer.ca'
version: stable
tag: 4.19
ctlplanes: 3
workers: 3
memory: 16384
numcpus: 16
pull_secret: /home/digimer/pull-secret.txt

Make sure there's a key for root and for the user running 'kcli';

if [ -e ~/.ssh/id_ed25519.pub ]; then echo key exists; else echo key needed; ssh-keygen -f ~/.ssh/id_ed25519 -P ""; fi
sudo kcli create kube openshift --paramfile ~/openshift-config.yml mk-anvil-02
Deploying on client local
Deploying cluster mk-anvil-02
Using stable version
Using 192.168.255.253 as api_ip
Downloading openshift-install from https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable-4.19
Move downloaded openshift-install somewhere in your PATH if you want to reuse it
Using installer version 4.19.7
Grabbing image rhcos-9.6.20250523-0-openstack.x86_64.qcow2 from url https://rhcos.mirror.openshift.com/art/storage/prod/streams/rhel-9.6/builds/9.6.20250523-0/x86_64/rhcos-9.6.20250523-0-openstack.x86_64.qcow2.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 40 1196M   40  480M    0     0  25.6M      0  0:00:46  0:00:18  0:00:28 25.7M
....

Go have a coffee or a nap, this will take a while...

More info;

https://kcli.readthedocs.io/en/latest/#openshift-cluster-creation
vim mytest.yml
kcli create kube openshift --paramfile mytest.yml mk-anvil-01


Notes

  • Bare iron OS is hardly relevant, it gets rebuilt.
defaultimg=""
ctlplanes="1"

kcli create plan --inputfile "$(dirname $0)/deployers/kcli-plan.yml" --threaded --param image=$defaultimg --param ctlplanes=$controllers --param workers=$workers $extregparam "$1"

parameters:
  info: kubesan kcli test plan
  cluster: kubesan-test
  ctlplanes: 3
  workers: 3
  image: fedora40


kubesan-test:   # replace with 'an-anvil-01'
  type: kube
  ctlplanes: {{ ctlplanes }}
  workers: {{ workers }}
  image: {{ image }}     # remove this
  domain: ''             
  <add pull-secret file>

mycluster:
  type: cluster
  kubetype: openshift
  okd: true
  ctlplanes: 3
  workers: 3

Test mk-anvil cluster:

parameters:
  info: kubesan kcli test plan
  cluster: mk-anvil
  ctlplanes: 3
  workers: 3
  image: fedora40

mk-anvil:
  type: kube
  ctlplanes: {{ ctlplanes }}
  workers: {{ workers }}
  image: {{ image }}
  domain: ''
  registry: true
  cmds:
    - yum -y install podman lvm2-lockd sanlock
    - sed -i "s|# use_watchdog = 1|use_watchdog = 0|" /etc/sanlock/sanlock.conf
    - >-
      sed -i "
      s|# validate_metadata = \"full\"|validate_metadata = \"none\"|;
      s|# multipath_component_detection = 1|multipath_component_detection = 0|;
      s|# md_component_detection = 1|md_component_detection = 0|;
      s|# backup = 1|backup = 0|;
      s|# archive = 1|archive = 0|;
      s|# use_lvmlockd = 0|use_lvmlockd = 1|;
      s|# thin_check_options = \[.*\]|thin_check_options = \[ \"-q\", \"--clear-needs-check-flag\", \"--skip-mappings\" \]|;
      s|# io_memory_size = 8192|io_memory_size = 65536|;
      s|# reserved_memory = 8192|reserved_memory = 0|
      " /etc/lvm/lvm.conf
{%for node in cluster|kubenodes(ctlplanes, workers) %}
    - if [ "$(hostname)" == "{{ node }}" ]; then sed -i "s|# host_id = 0|host_id = {{ loop.index }}|" /etc/lvm/lvmlocal.conf; fi
{%endfor%}
    - systemctl enable --now podman lvmlockd sanlock
# TODO: paramaterize shared storage
kubesan-test-shared-1.img:
  type: disk
  thin: false
  size: 5
  pool: default
  vms: {{ cluster|kubenodes(ctlplanes, workers) }}

References

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Alteeve's Niche! Alteeve Enterprise Support Community Support
© 2025 Alteeve. Intelligent Availability® is a registered trademark of Alteeve's Niche! Inc. 1997-2025
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.