Skip to content

Instantly share code, notes, and snippets.

View fabiand's full-sized avatar

Fabian Deutsch fabiand

View GitHub Profile
@fabiand
fabiand / examples.yaml
Last active December 20, 2023 11:15
explicit swap
# "Explicit swap"
# The user can explicitly request swap
kind: Pod
spec:
resources
requests:
# This assumes separate resources for mem and swap
# Set by user
memory: 2G
# Set by user
- hosts: localhost
tasks:
- name: Create VM
kubernetes.kubevirt.kubevirt_vm:
state: present
name: testvm
namespace: default
labels:
app: test
spec:
$ ./virtctl-v0.50.0-rc.0-linux-amd64
Available Commands:
plug volume add a volume to a running VM
completion generate the autocompletion script for the specified shell
console Connect to a console of a virtual machine instance.
expose Expose a virtual machine instance, virtual machine, or virtual machine instance replica set as a new service.
guest fs Return full list of filesystems available on the guest machine.
guestfs Start a shell into the libguestfs pod
guest osinfo Return guest agent info about operating system.
help Help about any command
@fabiand
fabiand / ssh_config
Last active December 15, 2023 07:18
# virtctl is in your $PATH
# You are logged into a cluster
# Then the snippet below enables seamless ssh login.
# Usage `ssh [<user>@]<vmname>.<namespace>.ocp`
# "ocp" can be anything, for convenience replace with your cluster's base fqdn
host *.ocp
ProxyCommand virtctl port-forward --stdio=true %h %p
@fabiand
fabiand / 4.12-flows.md
Last active February 27, 2023 08:32
flows.md
flowchart
    OCP --> AdminView
    OCP --> DevView

    subgraph Views
        DevView
        AdminView
    end
    
flowchart
    qPlatform["Current platform?"]
    qBM["With Bare-Metal nodes?"]
    qAZ["Special AZ needs?"]

    to-UPI["Use UPI"]
    to-hypershift["Use Hypershift"]

 qPlatform -- UPI-none --&gt; qBM
@fabiand
fabiand / fake-playbook.yaml
Last active November 16, 2022 10:28
Ansible Playbook for KubeVirt VM with InstanceTypes and Prefs
# JUST TO BRAINSTORM
- name: Create a VM object from an inline definition
vm.kubevirt.io:
state: present
name: my-vm
namespace: my-namespace
spec:
instancetype:
name: clarge
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: fedora
spec:
template:
spec:
domain:
cpu:
cores: 2
@fabiand
fabiand / mgloki.py
Last active July 14, 2022 11:39
Index pod/container logs into loki running locally
# loki from
# https://github.com/grafana/loki/tree/v2.6.0
# run:
# $ pwd
# <somewhere>/ocp-must-gather.local.614777<...>openshift-origin-must-gather-sha256-<...>77c9c15e76eca
# $ python3 mgloki.py
# namespaces/openshift-apiserver-operator/pods/openshift-apiserver-operator-76bd66d74b-v22tc/openshift-apiserver-operator-55bdd9d74b-v63tc.yaml
# …
#
@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"