搜索

7.8. Managing ConfigMaps, secrets, and service accounts in virtual machines

download PDF

You can use secrets, ConfigMaps, 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 ConfigMap 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, ConfigMaps, and service accounts as virtual machine disks so that you can use them across platforms without additional overhead.

7.8.1. Adding a secret, ConfigMap, or service account to a virtual machine

Add a secret, ConfigMap, or service account to a virtual machine by using the OpenShift Container Platform web console.

Prerequisites

  • The secret, ConfigMap, or service account that you want to add must exist in the same namespace as the target virtual machine.
  • The virtual machine must be powered off.

Procedure

  1. From the side menu, click Virtualization.
  2. Click the Virtual Machine tab.
  3. Select a virtual machine to open its Virtual Machine Overview page.
  4. Click the Environment tab.
  5. Click Select a resource and select a secret, ConfigMap, or service account from the list.
  6. Click Save.
  7. Optional. Add another object by clicking Add Config Map, Secret or Service Account.
注意

You can reset the form to the last saved state by clicking Reload.

Verification

  1. From the Virtual Machine Overview page, click the Disks tab.
  2. Check to ensure that the secret, ConfigMap, or service account is included in the list of disks.
  3. Optional. Start the virtual machine by clicking Actions Start Virtual Machine. You can now mount the secret, ConfigMap, or service account as you would mount any other disk.

7.8.2. Removing a secret, ConfigMap, or service account from a virtual machine

Remove a secret, ConfigMap, or service account from a virtual machine by using the OpenShift Container Platform web console.

Prerequisites

  • You must have at least one secret, ConfigMap, or service account that is attached to a virtual machine.
  • The virtual machine must be powered off.

Procedure

  1. From the side menu, click Virtualization.
  2. Click the Virtual Machine tab.
  3. Select a virtual machine to open its Virtual Machine Overview page.
  4. Click the Environment tab.
  5. Find the item that you want to delete in the list, and click the Delete button delete on the right side of the item.
  6. Click Save.
注意

You can reset the form to the last saved state by clicking Reload.

Verification

  1. From the Virtual Machine Overview page, click the Disks tab.
  2. Check to ensure that the secret, ConfigMap, or service account that you removed is no longer included in the list of disks.

7.8.3. Additional resources

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.