Skip to content

Instantly share code, notes, and snippets.

@tuna2134
Created November 22, 2022 10:30
Show Gist options
  • Save tuna2134/cc24c6e0cfaf59bd57c535b7f1bf2a77 to your computer and use it in GitHub Desktop.
Save tuna2134/cc24c6e0cfaf59bd57c535b7f1bf2a77 to your computer and use it in GitHub Desktop.
apiVersion: cdi.kubevirt.io/v1beta1
kind: DataVolume
metadata:
name: fdc
spec:
source:
registry:
url: "docker://quay.io/containerdisks/ubuntu:22.04"
pvc:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 48Gi
---
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
labels:
kubevirt.io/os: linux
name: fdc
spec:
running: true
template:
metadata:
labels:
kubevirt.io/domain: fdc
spec:
nodeSelector:
kubevirt.io/schedulable: "true"
domain:
devices:
disks:
- disk:
bus: virtio
name: disk0
- cdrom:
bus: sata
readonly: true
name: cloudinitdisk
interfaces:
- name: default
macAddress: '72:35:18:b7:59:7a'
masquerade: {}
machine:
type: q35
resources:
requests:
memory: 6G
cpu: '6'
networks:
- name: default
pod: {}
volumes:
- name: disk0
dataVolume:
name: fdc
- name: cloudinitdisk
cloudInitNoCloud:
userData: |
#cloud-config
hostname: fdc
ssh_pwauth: false
disable_root: true
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOLIO8ZX+55FPYMttkBIe7Ef9171ztgyLOyqDWbt3Xeh
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFdgG2seDrWqQNF4uqJndwlLJdsUX+IGQv01ENaEPxP6
runcmd:
- sudo perl -p -i.bak -e 's%(deb(?:-src|)\s+)https?://(?!archive\.canonical\.com|security\.ubuntu\.com)[^\s]+%$1http://mirrors.linode.com/ubuntu/%' /etc/apt/sources.list
- sudo apt update
- sudo apt upgrade -y
---
apiVersion: v1
kind: Service
metadata:
name: fdc-svc
spec:
type: LoadBalancer
selector:
kubevirt.io/domain: fdc
ports:
- protocol: TCP
name: tcp22
port: 22
targetPort: 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment