You can use secrets, config maps, and service accounts to pass configuration data to virtual machines. For example, you can:
Give a virtual machine access to a service that requires credentials by adding a secret to the virtual machine.
Store non-confidential configuration data in a config map so that a pod or another object can consume the data.
Allow a component to access the API server by associating a service account with that component.
OpenShift Virtualization exposes secrets, config maps, and service accounts as virtual machine disks so that you can use them across platforms without additional overhead. |
Add a secret, config map, or service account to a virtual machine by using the OpenShift Container Platform web console.
The secret, config map, or service account that you want to add must exist in the same namespace as the target virtual machine.
Click Workloads → Virtualization from the side menu.
Click the Virtual Machines tab.
Select a virtual machine to open the Virtual Machine Overview screen.
Click the Environment tab.
Click Select a resource and select a secret, config map, or service account from the list. A six character serial number is automatically generated for the selected resource.
Click Save.
Optional. Add another object by clicking Add Config Map, Secret or Service Account.
|
From the Virtual Machine Overview page, click the Disks tab.
Check to ensure that the secret, config map, or service account is included in the list of disks.
Optional. Choose the appropriate method to apply your changes:
If the virtual machine is running, restart the virtual machine by clicking Actions → Restart Virtual Machine.
If the virtual machine is stopped, start the virtual machine by clicking Actions → Start Virtual Machine.
You can now mount the secret, config map, or service account as you would mount any other disk.
Remove a secret, config map, or service account from a virtual machine by using the OpenShift Container Platform web console.
You must have at least one secret, config map, or service account that is attached to a virtual machine.
Click Workloads → Virtualization from the side menu.
Click the Virtual Machines tab.
Select a virtual machine to open the Virtual Machine Overview screen.
Click the Environment tab.
Find the item that you want to delete in the list, and click Remove on the right side of the item.
Click Save.
You can reset the form to the last saved state by clicking Reload. |
From the Virtual Machine Overview page, click the Disks tab.
Check to ensure that the secret, config map, or service account that you removed is no longer included in the list of disks.