Closed Neoclassic closed 3 weeks ago
Just to confirm with you, you tested this and it didn't work? https://kubevirt.io/user-guide/virtual_machines/startup_scripts/#cloud-init
Yeah I tested this. But didn't work. I think windows does not support cloud-init.
I expected that to work, just in case, what error do you see? Can you share the configuration you have tried?
This came up before at https://github.com/kubevirt/kubevirt/issues/7992#issuecomment-1171329507 maybe the author could share how he achieved it
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: myvm
spec:
running: true
template:
metadata:
labels:
kubevirt.io/domain: myvm
spec:
domain:
cpu:
cores: 4
features:
acpi: {}
apic: {}
hyperv:
relaxed: {}
vapic: {}
spinlocks:
spinlocks: 8191
clock:
utc: {}
timer:
hpet:
present: false
pit:
tickPolicy: delay
rtc:
tickPolicy: catchup
hyperv: {}
devices:
blockMultiQueue: true
disks:
- bootOrder: 1
disk:
bus: sata
name: cdromiso
- bootOrder: 2
disk:
bus: virtio
name: virtiocontainerdisk
- bootOrder: 3
disk:
bus: virtio
name: disk3
- bootOrder: 4
disk:
bus: virtio
name: config-volume
firmware:
bootloader:
efi:
secureBoot: false
machine:
type: q35
resources:
requests:
memory: 16G
nodeSelector:
beta.kubernetes.io/instance-type: m5.metal
volumes:
- name: cdromiso
dataVolume:
name: myvm
- containerDisk:
image: quay.io/kubevirt/virtio-container-disk
name: virtiocontainerdisk
- cloudInitNoCloud:
userData: |
manage_etc_hosts: true
hostname: myvm
bootcmd:
- 'powershell.exe -ExecutionPolicy bypass -Command $env:CUSTOM_VAR="dakshverma"'
name: disk3
- name: config-volume
configMap:
name: windows-vm-env
This is the VM definition. There is no error as such, but i cant see the envs or any file containing config.
testvm.log pod logs
I think tekton-task will inject the env and secret at bake/build time. But requirement is to have them at deploy time.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
/lifecycle rotten
@Neoclassic You got any workaround for this.
How would you folks expect this feature to work?
That an env var is set in every powershell in windows? Or that you can look at a file to understand all env vars? or … ?
How would you folks expect this feature to work?
That an env var is set in every powershell in windows?
Or that you can look at a file to understand all env vars?
or … ?
I think the ask is for a Start-UP script/Userdata kind of implementation for windows based kubevirt instances.
I see. Well You can use sysprep. You can use cloud-init (witn CloudBaseIT Windows for example).
You can use guestfs to inject a startup script.
What is missing?
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
.
Mark the issue as fresh with /remove-lifecycle rotten
.
/close
@kubevirt-bot: Closing this issue.
I have a windows image ready in qcow2 format. Now I want to inject some configuration at startup. I tried configDrive but its not visible in the VM created. Any other way to achieve this ?