Free RedHat EX316 Practice Test & Real Exam Questions
How do you use DNS to access VMs in OpenShift?
Correct Answer:
See the Explanation.
Explanation:
1. Expose VMs as Services (NodePort or ClusterIP).
2. Services are auto-resolved using <service-name>.<namespace>.svc
3. Inside pods/VMs: ping vm1.default.svc
4. For external, create external DNS entries or use OpenShift Route if HTTP-based.
Explanation:
1. Expose VMs as Services (NodePort or ClusterIP).
2. Services are auto-resolved using <service-name>.<namespace>.svc
3. Inside pods/VMs: ping vm1.default.svc
4. For external, create external DNS entries or use OpenShift Route if HTTP-based.
How do you ensure your VMs can be balanced by a service?
Correct Answer:
See the Explanation.
Explanation:
1. Confirm VMs use the bridge interface, not masquerade.
2. Check VM pods are labeled with kubevirt.io/domain=<vm-name>
3. Use this label in the service selector.
4. Ensure each VM listens on the target port.
5. Verify with curl or telnet.
Explanation:
1. Confirm VMs use the bridge interface, not masquerade.
2. Check VM pods are labeled with kubevirt.io/domain=<vm-name>
3. Use this label in the service selector.
4. Ensure each VM listens on the target port.
5. Verify with curl or telnet.
How do you restrict a NodePort service to only certain nodes?
Correct Answer:
See the Explanation.
Explanation:
1. Use firewall rules on nodes to block/allow NodePort traffic.
2. Or, use externalTrafficPolicy: Local to restrict to nodes with backing pods.
3. Example:
spec:
externalTrafficPolicy: Local
4. Only routes to nodes hosting the VM will work.
5. Improves traffic localization.
Explanation:
1. Use firewall rules on nodes to block/allow NodePort traffic.
2. Or, use externalTrafficPolicy: Local to restrict to nodes with backing pods.
3. Example:
spec:
externalTrafficPolicy: Local
4. Only routes to nodes hosting the VM will work.
5. Improves traffic localization.
How do you customize CPU and memory of a cloned VM?
Correct Answer:
See the Explanation.
Explanation:
1. After cloning, edit
VM: oc edit vm
<clone-name>
2. Modify:
resources:
requests:
memory: 4Gi
3. Save and restart the VM.
4. Validate with: oc describe vm <name>
5. View virt-launcher pod spec.
Explanation:
1. After cloning, edit
VM: oc edit vm
<clone-name>
2. Modify:
resources:
requests:
memory: 4Gi
3. Save and restart the VM.
4. Validate with: oc describe vm <name>
5. View virt-launcher pod spec.
How do you create an S3-compatible backup storage location for OADP?
Correct Answer:
See the Explanation.
Explanation:
1. Create a secret with access credentials:
oc create secret generic cloud-credentials \
--from-literal=cloud=aws \
--from-literal=aws_access_key_id=<ID> \
--from-literal=aws_secret_access_key=<KEY> \
-n oadp-operator
2. Apply BackupStorageLocation:
apiVersion: velero.io/v1
kind: BackupStorageLocation
metadata:
name: default
namespace: oadp-operator
spec:
provider: aws
objectStorage:
bucket: oadp-backup
prefix: vm-backups
config:
region: us-east-1
s3Url: https://<s3-provider-url>
insecureSkipTLSVerify: "true"
Explanation:
1. Create a secret with access credentials:
oc create secret generic cloud-credentials \
--from-literal=cloud=aws \
--from-literal=aws_access_key_id=<ID> \
--from-literal=aws_secret_access_key=<KEY> \
-n oadp-operator
2. Apply BackupStorageLocation:
apiVersion: velero.io/v1
kind: BackupStorageLocation
metadata:
name: default
namespace: oadp-operator
spec:
provider: aws
objectStorage:
bucket: oadp-backup
prefix: vm-backups
config:
region: us-east-1
s3Url: https://<s3-provider-url>
insecureSkipTLSVerify: "true"
How do you restore a VM from a snapshot while preserving the original VM?
Correct Answer:
See the Explanation.
Explanation:
1. Define a restore object:
apiVersion: snapshot.kubevirt.io/v1alpha1
kind: VirtualMachineRestore
metadata:
name: restore-test-vm
namespace: default
spec:
target:
apiGroup: kubevirt.io
kind: VirtualMachine
name: test-vm-restored
virtualMachineSnapshotName: test-vm-snap
2. Apply: oc apply -f vm-restore.yaml
3. Wait for restore to complete.
4. Confirm restored VM exists and is not auto-started.
5. Start with: virtctl start test-vm-restored
Explanation:
1. Define a restore object:
apiVersion: snapshot.kubevirt.io/v1alpha1
kind: VirtualMachineRestore
metadata:
name: restore-test-vm
namespace: default
spec:
target:
apiGroup: kubevirt.io
kind: VirtualMachine
name: test-vm-restored
virtualMachineSnapshotName: test-vm-snap
2. Apply: oc apply -f vm-restore.yaml
3. Wait for restore to complete.
4. Confirm restored VM exists and is not auto-started.
5. Start with: virtctl start test-vm-restored
How do you modify the imported VM's disk interface to virtio?
Correct Answer:
See the Explanation.
Explanation:
1. Edit the VM YAML:
disks:
- name:
rootdisk
disk:
bus: virtio
2. Reapply with: oc apply -f vm.yaml
3. Ensure VM OS has virtio drivers.
4. Restart the VM.
5. Confirm disk is recognized inside VM.
Explanation:
1. Edit the VM YAML:
disks:
- name:
rootdisk
disk:
bus: virtio
2. Reapply with: oc apply -f vm.yaml
3. Ensure VM OS has virtio drivers.
4. Restart the VM.
5. Confirm disk is recognized inside VM.
How do you install a software package from a .rpm file manually?
Correct Answer:
See the Explanation.
Explanation:
1. Copy .rpm to the VM.
2. Run:
sudo rpm -ivh package.rpm
3. Resolve dependencies if errors occur.
4. Confirm with rpm -q <package>
5. For .deb, use dpkg -i.
Explanation:
1. Copy .rpm to the VM.
2. Run:
sudo rpm -ivh package.rpm
3. Resolve dependencies if errors occur.
4. Confirm with rpm -q <package>
5. For .deb, use dpkg -i.
How do you create a backup for a virtual machine using Velero CLI?
Correct Answer:
See the Explanation.
Explanation:
1. Run:
velero backup create vm-backup --include-namespaces <vm-namespace> --wait
2. Add --snapshot-volumes if CSI snapshots are supported.
3. Confirm backup: velero backup get
4. View logs: velero backup logs vm-backup
5. Backup stored in S3 or compatible storage.
Explanation:
1. Run:
velero backup create vm-backup --include-namespaces <vm-namespace> --wait
2. Add --snapshot-volumes if CSI snapshots are supported.
3. Confirm backup: velero backup get
4. View logs: velero backup logs vm-backup
5. Backup stored in S3 or compatible storage.
How do you disable a service from starting at boot (e.g., postfix)?
Correct Answer:
See the Explanation.
Explanation:
1. Enter the VM shell.
2. Run:
sudo systemctl disable postfix
3. Confirm:
systemctl is-enabled postfix
4. Should return disabled.
5. Reboot to ensure it doesn't auto-start.
Explanation:
1. Enter the VM shell.
2. Run:
sudo systemctl disable postfix
3. Confirm:
systemctl is-enabled postfix
4. Should return disabled.
5. Reboot to ensure it doesn't auto-start.
How do you schedule VMs to specific nodes?
Correct Answer:
See the Explanation.
Explanation:
1. Label node: oc label node worker-1 vm-node=yes
2. Add nodeSelector to VM:
spec:
template:
spec:
nodeSelector:
vm-node: "yes"
3. Apply changes and restart VM.
Explanation:
1. Label node: oc label node worker-1 vm-node=yes
2. Add nodeSelector to VM:
spec:
template:
spec:
nodeSelector:
vm-node: "yes"
3. Apply changes and restart VM.
How do you expose a VM's secondary NIC using ClusterIP (Multus)?
Correct Answer:
See the Explanation.
Explanation:
1. Add Multus network to the VM and assign IP manually or via DHCP.
2. Inside VM: configure the app to bind to Multus interface.
3. Create a ClusterIP service with endpoint pointing to that IP.
4. Alternatively, use Endpoints object to define target manually.
5. Test internal access.
Explanation:
1. Add Multus network to the VM and assign IP manually or via DHCP.
2. Inside VM: configure the app to bind to Multus interface.
3. Create a ClusterIP service with endpoint pointing to that IP.
4. Alternatively, use Endpoints object to define target manually.
5. Test internal access.
How do you make cloud-init fields dynamic using template parameters?
Correct Answer:
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.
How do you enable SSH to a VM via ClusterIP service within the cluster?
Correct Answer:
See the Explanation.
Explanation:
1. Ensure VM is running and SSH is enabled on port 22.
2. Create a ClusterIP service exposing port 22.
3. From internal pod: ssh <user>@vm-service
4. If authentication fails, use cloud-init to inject SSH keys.
5. Confirm login and connectivity.
Explanation:
1. Ensure VM is running and SSH is enabled on port 22.
2. Create a ClusterIP service exposing port 22.
3. From internal pod: ssh <user>@vm-service
4. If authentication fails, use cloud-init to inject SSH keys.
5. Confirm login and connectivity.
