Skip to content

Instantly share code, notes, and snippets.

View fabiand's full-sized avatar

Fabian Deutsch fabiand

View GitHub Profile
@fabiand
fabiand / gist:1ecdcf45c75b38e8fb226e3f978b1fe0
Last active June 27, 2022 19:17
ResourceQuota without resource limits
# https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/
[fabiand@toolbox Downloads]$ minikube kubectl -- apply -f - <<EOF
apiVersion: v1
kind: ResourceQuota
metadata:
name: mem-cpu-demo
spec:
hard:
requests.cpu: "1"
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstanceDomainPreferences
metadata:
name: linux
spec:
preferNetworkInterfaceMultiQueue: true
preferBlockMultiQueue: true
diskDefaults:
preferedDiskBus: virtio
preferedCDROMBus: virtio
@fabiand
fabiand / kube-vm-network.sh
Last active October 5, 2021 05:38
POC to attach a VM to a CNI NIC using libvirt
#!/bin/sh
# POC to connect a libvirt VM to a Pod NIC created by CNI
# Resources:
# - rancher-vm networking https://github.com/rancher/vm/blob/master/docs/networking.md
# - qemu-ifup https://gist.github.com/Wayt/26d25002d00d7cb4348499a145456999
# - cni https://github.com/containernetworking/cni/blob/master/scripts/exec-plugins.sh
# yum install -y macchanger
@fabiand
fabiand / virt-pexpect.py
Last active June 22, 2021 22:13
How to auto-test an image using pexpect
import pexpect
image = "fedora-20.img"
user = "root"
password = "changeme"
# Define the qemu cmd to run
# The important bit is to redirect the serial to stdio
cmd = "qemu-kvm"
cmd += " -m 1024 -serial stdio -net user -net nic"
volumes:
- name: pvcdisk
persistentVolumeClaim:
claimName: disk-alpine
seedWith:
containerDisk:
image: some-registry/some-image:tag
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachineInstance
metadata:
labels:
special: vmi-kernel-boot
name: vmi-kernel-boot
spec:
domain:
devices:
firmware:
#!/bin/bash
# usage: cat topo.sh | ssh node01 bash | tee /dev/stderr | osage -Tpng -o noname.gv.png
NS=openshift-cnv
OC=${OC:-oc}
nsget() { $OC get -n $NS $@ ; }
operators() {
nsget deployments -l olm.owner --no-headers -o custom-columns=name:.metadata.name,count:.spec.replicas
}
---
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachineInstance
metadata:
labels:
special: vmi-alpine-kernel
name: vmi-alpine-kernel
spec:
domain:
firmware:
apiVersion: kubevirt.io/v1alpha3
kind: VirtualMachine
metadata:
name: testvm
spec:
running: false
template:
metadata:
labels:
team: Tiger

In order to use kernel auto-numa

  • kernel auto-numa continuous rebalancing
       <vcpu>NNN</vcpu>
       <vcpu placement="static">NNN</vcpu>
    
    provided NO <vcpupin vcpu="0" cpuset="xxx"/> is set inside ``