Deploy and Configure Virtual Appliance in KVM

Kernel-based Virtual Machine (KVM) uses Linux as a hypervisor to run virtual machines. For more information, see What is KVM?.

Note: This document contains links to RedHat documentation. Splunk AppDynamics makes no representation as to the accuracy of RedHat documentation because RedHat controls its own documentation.

You can deploy the Virtual Appliance by using the QCOW2 image. Splunk AppDynamics recommends you to use the custom scripts that are available in Splunk AppDynamics GitHub repository. This deployment requires three KVM hypervisors and runs single virtual machine in each hypervisors.

Note: Before you run these scripts, ensure to update or verify the configuration details in config.cfg such as tags, deployment configuration, and IP addresses. After you download the image and scripts, grant the 744 permission for the custom scripts:
chmod 744 ~/<folder path or filename>

前提条件

仮想アプライアンスを展開する前に、次のことを確認します。

  • ハイパーバイザ間で時間を同期できるように NTPサービスを有効にしている。
    $ timedatectl status
                   Local time: Thu 2024-10-03 22:36:06 UTC
               Universal time: Thu 2024-10-03 22:36:06 UTC
                     RTC time: Thu 2024-10-03 22:36:06
                    Time zone: Etc/UTC (UTC, +0000)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
  • KVM がサーバーで有効になっている。
    $ kvm-ok
    INFO: /dev/kvm exists
    KVM acceleration can be used
  • ブリッジされたデバイスが利用可能。config.cfg ファイルで指定するデバイス名に注意してください。

詳細については、Readme.md の「Ubuntu サーバーインストールの考慮事項」を参照してください。

Update and Verify the KVM Configuration

The custom scripts uses the configuration specified in the config.cfg file. Update and verify the configuration in the config.cfg file. This file includes the following parameters:

ParameterDescription

Storage Pool

This pool stores the image file and disks of the virtual machines. The storage pool parameters specifies the following:

  • The storage pool parameters for all the virtual machine.
  • The path of the virtual machine disk storage that is configured on each KVM node.

Network

Specifies the Linux bridge device that connects the virtual machine to the host network.

IP Addresses of the Host and Peers

Specifies IP addresses of the host and its peers. The Virtual Appliance cluster will deploy in the LIBVIRT_HOST_SELF IP address.

In LIBVIRT_HOST_PEERS, list the IP addresses of other KVM hypervisor nodes on which you want to deploy virtual machines.

Note: Do not specify the SELF IP address in the peers list.

Virtual Machine Network

Specifies the virtual machine network parameters such as cluster name, CIDRs, gateway, DNS, and host name.

Virtual Machine Size

Specifies the Virtual Appliance profile with its specifications. See Virtual Appliance Sizing.

Note: Currently, the Virtual Appliance supports only Small profile on KVM.

The following is an example config.cfg script:

Example

## libvirt/kvm host user with virt permissions
DEPLOY_ID=${USER}   ## defaults to current user

## Libvirt directory storage pool name
# Storage pool parameters
STORAGE_POOL="appdva-storage"         # node-local directory
STORAGE_PATH="/data/${STORAGE_POOL}"  # path to local storage on each node

# Network parameters (kvm phys host VM bridge name)
BRIDGE_NAME=<Name of the Bridge Network>

# Physical libvirt hypervisor IPs
# used for virsh remote connections:
#   VIRT_CONNECTION_URL="qemu+ssh://${DEPLOY_ID}@${HOSTIP}/system"
# enabling remote operations on different physical libvirt nodes
#
LIBVIRT_HOST_SELF="10.0.0.1" # specify the primary node here 
LIBVIRT_HOST_PEERS=(
    "10.0.0.2"
    "10.0.0.3"
)
# LIBVIRT_HOST_PEERS=( )

## VM Network parameters
VM_CLUSTER_NAME="libvirt1"
# these CIDR values change with the cluster name, consult the wiki
VM_CIDRS=(
    "10.0.0.11/20"
    "10.0.0.12/20"
    "10.0.0.13/20"
)
VM_GATEWAY=10.x.x.x
VM_DNS=10.x.x.x
VM_HOSTNAME_PREFIX="appdva-${VM_CLUSTER_NAME}-vm"
VM_NAME_PREFIX="${DEPLOY_ID}-${VM_HOSTNAME_PREFIX}"

## VM size parameters
# profile=small
NUM_VMS=3
VM_VCPUS=16
VM_MEMORY_GB=64
VM_OS_DISK_GB=200
VM_DATA_DISK_GB=500

カスタムスクリプトの実行

KVM に仮想マシンを展開するには、指定された順序でスクリプトを実行することを推奨します。

ステップScript説明
1ハイパーバイザを設定します。 01-prepare-hypervisor.sh

このスクリプトは次のことを行います。

  • 仮想アプライアンスの展開に必要なパッケージをインストールします。
    cloud-image-utils, cpu-checker, libvirt-clients, libvirt-daemon, libvirt-daemon-driver-qemu, libvirt-daemon-system, jq, ovmf, virtinst, virt-viewer, qemu-system-x86 qemu-block-extra, qemu-utils, numad, numactl, and sysstat
  • 仮想マシンをホストするようにカーネル cmdline を調整します。
  • KVM パラメータを更新します。
  • SSH キー ペアを生成します。
2クラスターを実行します。 run-cluster

このスクリプトは次のことを行います。

  • 仮想マシンを使用して 3 ノードクラスターを作成します。
  • クラスター内の各ノードのストレージを設定します。
  • libvirt で仮想マシンのイメージを作成するためのストレージディレクトリを管理できるようにします。
3クラスターステータスを確認します。 cluster-status

このスクリプトを実行して、仮想アプライアンスクラスターがアクティブであるかどうかを確認します。

追加のスクリプト

ストレージと仮想マシンをクリーンアップする場合は、次のスクリプトを実行して各タスクを実施できます。

Script説明
cleanup-storage 仮想アプライアンスクラスターのストレージプールを削除します。
cleanup-vms 仮想アプライアンスの仮想マシンを削除します。