Created
October 9, 2024 12:19
-
-
Save qinqon/7132c77b3b02c83b6805e2c1a955835e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash -xe | |
| kubectl patch kubevirts -n kubevirt kubevirt --type=json -p="[{\"op\": \"add\", \"path\": \"/spec/configuration/network\", \"value\": { | |
| \"binding\": { | |
| \"managedTap\": { | |
| \"domainAttachmentType\": \"managedTap\", | |
| \"migration\": {}, | |
| } | |
| } | |
| }}]" | |
| kubectl apply -f - <<EOF | |
| --- | |
| apiVersion: kubevirt.io/v1 | |
| kind: KubeVirt | |
| metadata: | |
| name: kubevirt | |
| namespace: kubevirt | |
| spec: | |
| configuration: | |
| developerConfiguration: | |
| featureGates: | |
| - NetworkBindingPlugins | |
| --- | |
| apiVersion: v1 | |
| kind: Namespace | |
| metadata: | |
| name: poc1 | |
| --- | |
| apiVersion: k8s.cni.cncf.io/v1 | |
| kind: NetworkAttachmentDefinition | |
| metadata: | |
| namespace: poc1 | |
| name: l2 | |
| spec: | |
| config: |2 | |
| { | |
| "cniVersion": "0.3.0", | |
| "name": "l2-network", | |
| "type": "ovn-k8s-cni-overlay", | |
| "topology":"layer2", | |
| "subnets": "10.100.200.0/24,2014:100:200::0/60", | |
| "netAttachDefName": "poc1/l2", | |
| "allowPersistentIPs": true, | |
| "role": "primary" | |
| } | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| namespace: poc1 | |
| name: vmi-fedora-a-iperf3 | |
| spec: | |
| type: NodePort | |
| ipFamilyPolicy: PreferDualStack | |
| selector: | |
| vm.kubevirt.io/name: vmi-fedora-a | |
| ports: | |
| - protocol: TCP | |
| port: 5201 | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| namespace: poc1 | |
| name: vmi-fedora-b-iperf3 | |
| spec: | |
| type: NodePort | |
| ipFamilyPolicy: PreferDualStack | |
| selector: | |
| vm.kubevirt.io/name: vmi-fedora-b | |
| ports: | |
| - protocol: TCP | |
| port: 5201 | |
| --- | |
| apiVersion: kubevirt.io/v1 | |
| kind: VirtualMachine | |
| metadata: | |
| labels: | |
| special: vmi-fedora-a | |
| namespace: poc1 | |
| name: vmi-fedora-a | |
| spec: | |
| running: true | |
| template: | |
| spec: | |
| domain: | |
| devices: | |
| disks: | |
| - disk: | |
| bus: virtio | |
| name: containerdisk | |
| - disk: | |
| bus: virtio | |
| name: cloudinitdisk | |
| interfaces: | |
| - name: ovn-kubernetes | |
| binding: | |
| name: managedTap | |
| rng: {} | |
| resources: | |
| requests: | |
| memory: 1024M | |
| networks: | |
| - name: ovn-kubernetes | |
| pod: {} | |
| terminationGracePeriodSeconds: 0 | |
| volumes: | |
| - containerDisk: | |
| image: quay.io/ellorent/fedora-with-test-tooling:tcpdump | |
| name: containerdisk | |
| - cloudInitNoCloud: | |
| userData: |- | |
| #cloud-config | |
| password: fedora | |
| chpasswd: { expire: False } | |
| networkData: |- | |
| version: 2 | |
| ethernets: | |
| eth0: | |
| dhcp4: true | |
| dhcp6: true | |
| ipv6-address-generation: eui64 | |
| name: cloudinitdisk | |
| --- | |
| apiVersion: kubevirt.io/v1 | |
| kind: VirtualMachine | |
| metadata: | |
| labels: | |
| special: vmi-fedora-b | |
| namespace: poc1 | |
| name: vmi-fedora-b | |
| spec: | |
| running: true | |
| template: | |
| spec: | |
| domain: | |
| devices: | |
| disks: | |
| - disk: | |
| bus: virtio | |
| name: containerdisk | |
| - disk: | |
| bus: virtio | |
| name: cloudinitdisk | |
| interfaces: | |
| - name: pod | |
| binding: | |
| name: managedTap | |
| rng: {} | |
| resources: | |
| requests: | |
| memory: 1024M | |
| networks: | |
| - name: pod | |
| pod: {} | |
| terminationGracePeriodSeconds: 0 | |
| volumes: | |
| - containerDisk: | |
| image: quay.io/ellorent/fedora-with-test-tooling:tcpdump | |
| name: containerdisk | |
| - cloudInitNoCloud: | |
| userData: |- | |
| #cloud-config | |
| password: fedora | |
| chpasswd: { expire: False } | |
| networkData: |- | |
| version: 2 | |
| ethernets: | |
| eth0: | |
| dhcp4: true | |
| dhcp6: true | |
| ipv6-address-generation: eui64 | |
| name: cloudinitdisk | |
| EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment