問題1
How do you verify the performance of a VM disk (I/O benchmarking)?
How do you verify the performance of a VM disk (I/O benchmarking)?
正確答案:
See the Explanation.
Explanation:
1. Access the VM console: virtctl console <vm>
2. Run:
yum install -y fio
fio --name=test --size=1G --rw=randread --bs=4k --iodepth=64 --numjobs=4 --runtime=60
3. Evaluate read/write throughput and IOPS.
4. Test multiple storage classes if needed.
5. Tune disk type for better performance.
Explanation:
1. Access the VM console: virtctl console <vm>
2. Run:
yum install -y fio
fio --name=test --size=1G --rw=randread --bs=4k --iodepth=64 --numjobs=4 --runtime=60
3. Evaluate read/write throughput and IOPS.
4. Test multiple storage classes if needed.
5. Tune disk type for better performance.
問題2
How do you resize a VM disk using PVC expansion?
How do you resize a VM disk using PVC expansion?
正確答案:
See the Explanation.
Explanation:
1. Ensure the storage class supports allowVolumeExpansion.
2. Run:
oc patch pvc vm-root-disk -p '{"spec": {"resources": {"requests": {"storage": "15Gi"}}}}'
3. Restart the VM.
4. Resize partition inside the OS using growpart or resize2fs.
5. Confirm disk size with df -h.
Explanation:
1. Ensure the storage class supports allowVolumeExpansion.
2. Run:
oc patch pvc vm-root-disk -p '{"spec": {"resources": {"requests": {"storage": "15Gi"}}}}'
3. Restart the VM.
4. Resize partition inside the OS using growpart or resize2fs.
5. Confirm disk size with df -h.
問題3
How do you expose a VM to a custom domain using an Ingress controller instead of Route?
How do you expose a VM to a custom domain using an Ingress controller instead of Route?
正確答案:
See the Explanation.
Explanation:
1. Create a ClusterIP service for the VM.
2. Define an Ingress object pointing to that service.
3. Example:
rules:
- host:
myapp.example.com
http:
paths:
-
path: /
back
end:
service:
name: vm-
service port:
number: 80
4. Ensure DNS resolves to Ingress controller IP.
5. Test with curl myapp.example.com.
Explanation:
1. Create a ClusterIP service for the VM.
2. Define an Ingress object pointing to that service.
3. Example:
rules:
- host:
myapp.example.com
http:
paths:
-
path: /
back
end:
service:
name: vm-
service port:
number: 80
4. Ensure DNS resolves to Ingress controller IP.
5. Test with curl myapp.example.com.
問題4
How do you create a virtual machine using the CLI with a YAML manifest?
How do you create a virtual machine using the CLI with a YAML manifest?
正確答案:
See the Explanation.
Explanation:
1. Create a vm.yaml
file: apiVersion:
kubevirt.io/v1
kind: VirtualMachine
metadata:
name: test-vm
namespace: default
spec:
running: true
template:
spec:
domain:
devices:
disks:
- name: rootdisk
disk:
bus: virtio
resources:
requests:
memory: 1Gi
volumes:
- name:
rootdisk
containerD
isk:
image: quay.io/containerdisks/fedora:latest
2. Apply with: oc apply -f vm.yaml
3. Check status: oc get vm test-vm
Explanation:
1. Create a vm.yaml
file: apiVersion:
kubevirt.io/v1
kind: VirtualMachine
metadata:
name: test-vm
namespace: default
spec:
running: true
template:
spec:
domain:
devices:
disks:
- name: rootdisk
disk:
bus: virtio
resources:
requests:
memory: 1Gi
volumes:
- name:
rootdisk
containerD
isk:
image: quay.io/containerdisks/fedora:latest
2. Apply with: oc apply -f vm.yaml
3. Check status: oc get vm test-vm
問題5
How do you delete a snapshot but keep the underlying data volumes?
How do you delete a snapshot but keep the underlying data volumes?
正確答案:
See the Explanation.
Explanation:
1. Run: oc delete vmsnapshot <name>
2. If using deletionPolicy: Retain, the volumesnapshotcontents remain.
3. Use snapshots for manual restore.
4. PVCs remain unaffected.
5. You can later recreate snapshot objects if needed.
Explanation:
1. Run: oc delete vmsnapshot <name>
2. If using deletionPolicy: Retain, the volumesnapshotcontents remain.
3. Use snapshots for manual restore.
4. PVCs remain unaffected.
5. You can later recreate snapshot objects if needed.
問題6
How do you make cloud-init fields dynamic using template parameters?
How do you make cloud-init fields dynamic using template parameters?
正確答案:
See the Explanation.
Explanation:
1. Use substitution:
userData: |
#cloud-config
hostname: ${HOSTNAME}
ssh_authorized_keys:
- ${SSH_KEY}
2. Define HOSTNAME and SSH_KEY in template parameters.
3. Use oc process -p to override values.
4. Allows per-VM customization.
5. Great for templated automation.
Explanation:
1. Use substitution:
userData: |
#cloud-config
hostname: ${HOSTNAME}
ssh_authorized_keys:
- ${SSH_KEY}
2. Define HOSTNAME and SSH_KEY in template parameters.
3. Use oc process -p to override values.
4. Allows per-VM customization.
5. Great for templated automation.
問題7
How do you handle conflicts during cloning (e.g., duplicate disk names)?
How do you handle conflicts during cloning (e.g., duplicate disk names)?
正確答案:
See the Explanation.
Explanation:
1. Rename disks and PVCs during cloning.
2. Use metadata.name overrides for DV.
3. Avoid using original VM name in disk names.
4. Review cloned VM YAML before applying.
5. Prevents import failures.
Explanation:
1. Rename disks and PVCs during cloning.
2. Use metadata.name overrides for DV.
3. Avoid using original VM name in disk names.
4. Review cloned VM YAML before applying.
5. Prevents import failures.
問題8
How do you enable a service to start automatically at boot (e.g., chronyd)?
How do you enable a service to start automatically at boot (e.g., chronyd)?
正確答案:
See the Explanation.
Explanation:
1. Access the VM.
2. Run:
sudo systemctl enable chronyd
3. Reboot the
VM: sudo
reboot
4. After reboot, verify:
systemctl is-enabled
chronyd
5. Should return enabled.
Explanation:
1. Access the VM.
2. Run:
sudo systemctl enable chronyd
3. Reboot the
VM: sudo
reboot
4. After reboot, verify:
systemctl is-enabled
chronyd
5. Should return enabled.
問題9
How do you check the virtualization dashboard for system health?
How do you check the virtualization dashboard for system health?
正確答案:
See the Explanation.
Explanation:
1. Go to Administrator view in the OpenShift Web Console
2. Navigate to Virtualization Overview
3. Check health of subsystems like CDI, HCO, SSP
4. Verify running VMs, templates, alerts
5. View recent events and system metrics
Explanation:
1. Go to Administrator view in the OpenShift Web Console
2. Navigate to Virtualization Overview
3. Check health of subsystems like CDI, HCO, SSP
4. Verify running VMs, templates, alerts
5. View recent events and system metrics
問題10
How do you test outbound NAT from a VM connected via pod network?
How do you test outbound NAT from a VM connected via pod network?
正確答案:
See the Explanation.
Explanation:
1. VM should use masquerade interface (default).
2. Inside VM: ping 8.8.8.8 or curl http://example.com
3. External IP is seen via NAT.
4. Run tcpdump on node interface to confirm NAT.
5. Useful when Multus is not needed.
Explanation:
1. VM should use masquerade interface (default).
2. Inside VM: ping 8.8.8.8 or curl http://example.com
3. External IP is seen via NAT.
4. Run tcpdump on node interface to confirm NAT.
5. Useful when Multus is not needed.
問題11
How do you live attach a disk to a running VM (if hotplug is enabled)?
How do you live attach a disk to a running VM (if hotplug is enabled)?
正確答案:
See the Explanation.
Explanation:
1. Create PVC for the disk.
2. Use:
virtctl addvolume <vm-name> --volume-name hotplug-disk --persist
3. Monitor attachment: oc describe vmi <vm-name>
4. Access inside VM: lsblk, dmesg
5. Detach with virtctl removevolume.
Explanation:
1. Create PVC for the disk.
2. Use:
virtctl addvolume <vm-name> --volume-name hotplug-disk --persist
3. Monitor attachment: oc describe vmi <vm-name>
4. Access inside VM: lsblk, dmesg
5. Detach with virtctl removevolume.
問題12
How do you install a package (e.g., curl) on a Debian/Ubuntu-based VM?
How do you install a package (e.g., curl) on a Debian/Ubuntu-based VM?
正確答案:
See the Explanation.
Explanation:
1. SSH into the VM or use console.
2. Update repo:
sudo apt update
3. Install package:
sudo apt install -y
curl
4. Confirm
with: curl --
version
5. Successful output indicates installation.
Explanation:
1. SSH into the VM or use console.
2. Update repo:
sudo apt update
3. Install package:
sudo apt install -y
curl
4. Confirm
with: curl --
version
5. Successful output indicates installation.
問題13
How do you edit a default template to change its disk size?
How do you edit a default template to change its disk size?
正確答案:
See the Explanation.
Explanation:
1. Export the template:
oc get template <name> -n openshift -o yaml > custom-template.yaml
2. Modify the disk size under dataVolumeTemplates: or PVC size.
3. Change template metadata.name.
4. Apply: oc apply -f custom-template.yaml
5. Use new template for VM creation.
Explanation:
1. Export the template:
oc get template <name> -n openshift -o yaml > custom-template.yaml
2. Modify the disk size under dataVolumeTemplates: or PVC size.
3. Change template metadata.name.
4. Apply: oc apply -f custom-template.yaml
5. Use new template for VM creation.