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.
OKD Virtualization exposes secrets, config maps, and service accounts as virtual machine disks so that you can use them across platforms without additional overhead. |
You add a secret, config map, or service account to a virtual machine by using the OKD web console.
These resources are added to the virtual machine as disks. You then mount the secret, config map, or service account as you would mount any other disk.
If the virtual machine is running, changes will not take effect until you restart the virtual machine. The newly added resources are marked as pending changes for both the Environment and Disks tab in the Pending Changes banner at the top of the page.
The secret, config map, or service account that you want to add must exist in the same namespace as the target virtual machine.
Click Virtualization → VirtualMachines from the side menu.
Select a virtual machine to open the VirtualMachine details page.
In the Environment tab, click Add Config Map, Secret or Service Account.
Click Select a resource and select a resource from the list. A six character serial number is automatically generated for the selected resource.
Optional: Click Reload to revert the environment to its last saved state.
Click Save.
On the VirtualMachine details page, click the Disks tab and verify that the secret, config map, or service account is included in the list of disks.
Restart the virtual machine by clicking Actions → Restart.
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 OKD web console.
You must have at least one secret, config map, or service account that is attached to a virtual machine.
Click Virtualization → VirtualMachines from the side menu.
Select a virtual machine to open the VirtualMachine details page.
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. |
On the VirtualMachine details 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.