From 3ba7f6dcef560de0b8e81f700ed669a90b65eda5 Mon Sep 17 00:00:00 2001 From: Robert Bohne Date: Wed, 14 Jan 2026 16:48:56 +0100 Subject: [PATCH] init virtual bmc --- content/kubevirt/virtual-bmc/index.md | 46 +++++++ .../kubevirt/virtual-bmc/install-config.yaml | 62 +++++++++ .../kubevirt/virtual-bmc/node-template.yaml | 124 ++++++++++++++++++ .../kubevirt/virtual-bmc/single-vm-vbmc.yaml | 58 ++++++++ content/kubevirt/virtual-bmc/single-vm.yaml | 40 ++++++ 5 files changed, 330 insertions(+) create mode 100755 content/kubevirt/virtual-bmc/index.md create mode 100755 content/kubevirt/virtual-bmc/install-config.yaml create mode 100755 content/kubevirt/virtual-bmc/node-template.yaml create mode 100755 content/kubevirt/virtual-bmc/single-vm-vbmc.yaml create mode 100755 content/kubevirt/virtual-bmc/single-vm.yaml diff --git a/content/kubevirt/virtual-bmc/index.md b/content/kubevirt/virtual-bmc/index.md new file mode 100755 index 00000000..e86a5a3f --- /dev/null +++ b/content/kubevirt/virtual-bmc/index.md @@ -0,0 +1,46 @@ +--- +title: Virtual BMC +linktitle: Virtual BMC +description: Virtual BMC with VM's on KubeVirt / OCP-V +tags: ['cnv', 'kubevirt','ocp-v','v4.18','bmc','fakefish'] +--- +# Virtual BMC with VM's on KubeVirt / OCP-V + +Two options available, lets go with fakefish: + +* https://github.com/starbops/kubevirtbmc +* NEW: https://github.com/v1k0d3n/kubevirt-redfish +* https://github.com/openshift-metal3/fakefish/tree/main/kubevirt_scripts + +Tested with: + +|Component|Version| +|---|---| +|OpenShift|v4.18| +|OpenShift Virt|v4.18| + +## Simple single VM example + +```shell +export HOST="ff-node-oi5cyy-rbohne-fakefish.apps.isar.coe.muc.redhat.com" +export ISO_URL=http://tinycorelinux.net/16.x/x86/release/Core-current.iso + +curl -s https://$HOST/redfish/v1/Systems | jq -r + +curl -s https://$HOST/redfish/v1/Managers/1/VirtualMedia/Cd | jq '[{iso_connected: .Inserted}]' + + +curl -d \ + '{"Image":"'"$ISO_URL"'", "Inserted": true}' \ + -H "Content-Type: application/json" \ + -X POST \ + https://$HOST/redfish/v1/Managers/1/VirtualMedia/Cd/Actions/VirtualMedia.InsertMedia + + +curl -s -d '{"ResetType":"Off"}' \ + -H "Content-Type: application/json" -X POST \ + https://$HOST/redfish/v1/Systems/1/Actions/ComputerSystem.Reset + + +``` + diff --git a/content/kubevirt/virtual-bmc/install-config.yaml b/content/kubevirt/virtual-bmc/install-config.yaml new file mode 100755 index 00000000..adf57437 --- /dev/null +++ b/content/kubevirt/virtual-bmc/install-config.yaml @@ -0,0 +1,62 @@ +apiVersion: v1 +baseDomain: coe.muc.redhat.com +cpuPartitioningMode: None +compute: + - architecture: amd64 + hyperthreading: Enabled + name: worker + platform: {} + replicas: 0 +controlPlane: + architecture: amd64 + hyperthreading: Enabled + name: master + platform: {} + replicas: 3 +metadata: + creationTimestamp: null + name: rbohne-fakefish +networking: + clusterNetwork: + - cidr: 10.128.0.0/14 + hostPrefix: 23 + machineNetwork: + - cidr: 10.32.96.0/20 + networkType: OVNKubernetes + serviceNetwork: + - 172.30.0.0/16 +platform: + baremetal: + hosts: + - name: node-0tfcw7 + role: master + BootMACAddress: 02:d8:6d:00:00:4a + bmc: + address: redfish://ff-node-0tfcw7-rbohne-fakefish.apps.isar.coe.muc.redhat.com/redfish/v1/Systems/1 + username: "fakefish" + password: "fakefish" + disableCertificateVerification: True + - name: node-ovacww + role: master + BootMACAddress: 02:d8:6d:00:00:4b + bmc: + address: redfish://ff-node-ovacww-rbohne-fakefish.apps.isar.coe.muc.redhat.com/redfish/v1/Systems/1 + username: "fakefish" + password: "fakefish" + disableCertificateVerification: True + - name: node-puyubl + role: master + BootMACAddress: 02:d8:6d:00:00:4c + bmc: + address: redfish://ff-node-puyubl-rbohne-fakefish.apps.isar.coe.muc.redhat.com/redfish/v1/Systems/1 + username: "fakefish" + password: "fakefish" + disableCertificateVerification: True + apiVIPs: + - "10.32.98.7" + ingressVIPs: + - "10.32.98.8" +publish: External +pullSecret: ... +sshKey: | + ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEQM82o2imwpHyGVO7DxCNbdE0ZWnkp6oxdawb7/MOCT coe-muc diff --git a/content/kubevirt/virtual-bmc/node-template.yaml b/content/kubevirt/virtual-bmc/node-template.yaml new file mode 100755 index 00000000..8162b26e --- /dev/null +++ b/content/kubevirt/virtual-bmc/node-template.yaml @@ -0,0 +1,124 @@ +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + name: ocp-node +objects: + - apiVersion: apps/v1 + kind: Deployment + metadata: + labels: + app: ff-${NAME} + name: ff-${NAME} + spec: + replicas: 1 + selector: + matchLabels: + app: ff-${NAME} + strategy: {} + template: + metadata: + labels: + app: ff-${NAME} + spec: + automountServiceAccountToken: true + serviceAccountName: fakefish + containers: + - image: quay.io/rbohne/fakefish:kubevirt-20250519T133755 + name: fakefish + resources: {} + args: + - "--remote-bmc" + - ${NAME}_${NAMESPACE} + - "--tls-mode" + - "disabled" + - apiVersion: v1 + kind: Service + metadata: + labels: + app: ff-${NAME} + name: ff-${NAME} + spec: + ports: + - name: http + port: 9000 + protocol: TCP + targetPort: 9000 + selector: + app: ff-${NAME} + type: ClusterIP + + - apiVersion: route.openshift.io/v1 + kind: Route + metadata: + name: ff-${NAME} + spec: + port: + targetPort: http + tls: + termination: edge + to: + kind: "Service" + name: ff-${NAME} + weight: null + - apiVersion: kubevirt.io/v1 + kind: VirtualMachine + metadata: + annotations: + name: ${NAME} + namespace: ${NAMESPACE} + spec: + dataVolumeTemplates: + - metadata: + creationTimestamp: null + name: ${NAME}-root + spec: + source: + blank: {} + storage: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 120Gi + storageClassName: ocs-storagecluster-ceph-rbd-virtualization + runStrategy: Manual + template: + spec: + architecture: amd64 + domain: + cpu: + cores: 16 + devices: + disks: + - disk: + bus: virtio + name: root + interfaces: + - bridge: {} + model: virtio + name: coe + machine: + type: pc-q35-rhel9.4.0 + memory: + guest: 32Gi + resources: + limits: + memory: 33188Mi + requests: + memory: 32Gi + networks: + - multus: + networkName: coe-bridge + name: coe + volumes: + - dataVolume: + name: ${NAME}-root + name: root +parameters: +- description: VM name + from: node-[a-z0-9]{6} + generate: expression + name: NAME +- description: Namespace of the DataSource + name: NAMESPACE + required: true diff --git a/content/kubevirt/virtual-bmc/single-vm-vbmc.yaml b/content/kubevirt/virtual-bmc/single-vm-vbmc.yaml new file mode 100755 index 00000000..cab9f082 --- /dev/null +++ b/content/kubevirt/virtual-bmc/single-vm-vbmc.yaml @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: fakefish-single-vm + name: fakefish-single-vm +spec: + replicas: 1 + selector: + matchLabels: + app: fakefish-single-vm + strategy: {} + template: + metadata: + labels: + app: fakefish-single-vm + spec: + automountServiceAccountToken: true + serviceAccountName: fakefish + containers: + - image: quay.io/rbohne/fakefish:kubevirt-20250519T133755 + name: fakefish + resources: {} + args: + - "--remote-bmc" + - "single-vm_rbohne-fakefish" + - "--tls-mode" + - "disabled" +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: fakefish-single-vm + name: fakefish-single-vm +spec: + ports: + - name: http + port: 9000 + protocol: TCP + targetPort: 9000 + selector: + app: fakefish-single-vm + type: ClusterIP +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: fakefish-single-vm +spec: + port: + targetPort: http + tls: + termination: edge + to: + kind: "Service" + name: fakefish-single-vm + weight: null \ No newline at end of file diff --git a/content/kubevirt/virtual-bmc/single-vm.yaml b/content/kubevirt/virtual-bmc/single-vm.yaml new file mode 100755 index 00000000..a06ca66f --- /dev/null +++ b/content/kubevirt/virtual-bmc/single-vm.yaml @@ -0,0 +1,40 @@ +apiVersion: kubevirt.io/v1 +kind: VirtualMachine +metadata: + labels: + kubevirt.io/vm: single-vm + name: single-vm +spec: + dataVolumeTemplates: + - apiVersion: cdi.kubevirt.io/v1beta1 + kind: DataVolume + metadata: + name: single-vm-root + spec: + source: + blank: {} + storage: + resources: + requests: + storage: 30Gi + runStrategy: Manual + template: + metadata: + labels: + kubevirt.io/vm: single-vm + tentant: tentant + spec: + domain: + devices: + disks: + - disk: + bus: virtio + name: rootdisk + resources: + requests: + memory: 1024Mi + terminationGracePeriodSeconds: 0 + volumes: + - dataVolume: + name: single-vm-root + name: rootdisk