Skip to content

Offline Upgrade of the Virtual Machine Module

This page explains how to install or upgrade the Virtual Machine module after downloading it from the Download Center.

Info

The term "virtnest" appearing in the following commands or scripts is the internal development code name for the Virtual Machine module.

Load Images from the Installation Package

You can load the images using one of the following two methods. When there is an container registry available in your environment, it is recommended to choose the chart-syncer method for synchronizing the images to the container registry, as it is more efficient and convenient.

Synchronize Images to the container registry using chart-syncer

  1. Create load-image.yaml file.

    Note

    All parameters in this YAML file are mandatory. You need a private container registry and modify the relevant configurations.

    If the chart repo is already installed in your environment, chart-syncer also supports exporting the chart as a tgz file.

    load-image.yaml
    source:
      intermediateBundlesPath: virtnest-offline # (1)
    target:
      containerRegistry: 10.16.10.111 # (2)
      containerRepository: release.daocloud.io/virtnest # (3)
      repo:
        kind: HARBOR # (4)
        url: http://10.16.10.111/chartrepo/release.daocloud.io # (5)
        auth:
          username: "admin" # (6)
          password: "Harbor12345" # (7)
      containers:
        auth:
          username: "admin" # (8)
          password: "Harbor12345" # (9)
    
    1. The relative path to run the charts-syncer command, not the relative path between this YAML file and the offline package.
    2. Change to your container registry URL.
    3. Change to your container registry.
    4. It can also be any other supported Helm Chart repository type.
    5. Change to the chart repo URL.
    6. Your container registry username.
    7. Your container registry password.
    8. Your container registry username.
    9. Your container registry password.

    If the chart repo is not installed in your environment, chart-syncer also supports exporting the chart as a tgz file and storing it in the specified path.

    load-image.yaml
    source:
      intermediateBundlesPath: virtnest-offline # (1)
    target:
      containerRegistry: 10.16.10.111 # (2)
      containerRepository: release.daocloud.io/virtnest # (3)
      repo:
        kind: LOCAL
        path: ./local-repo # (4)
      containers:
        auth:
          username: "admin" # (5)
          password: "Harbor12345" # (6)
    
    1. The relative path to run the charts-syncer command, not the relative path between this YAML file and the offline package.
    2. Change to your container registry URL.
    3. Change to your container registry.
    4. Local path of the chart.
    5. Your container registry username.
    6. Your container registry password.
  2. Run the command to synchronize the images.

    charts-syncer sync --config load-image.yaml
    

Load Images Directly using Docker or containerd

Unpack and load the image files.

  1. Unpack the tar archive.

    tar xvf virtnest.bundle.tar
    

    After successful extraction, you will have three files:

    • hints.yaml
    • images.tar
    • original-chart
  2. Load the images from the local file to Docker or containerd.

    docker load -i images.tar
    
    ctr -n k8s.io image import images.tar
    

Note

Perform the Docker or containerd image loading operation on each node. After loading is complete, tag the images to match the Registry and Repository used during installation.

Upgrade

There are two upgrade methods available. You can choose the appropriate upgrade method based on the prerequisites:

  1. Check if the Virtual Machine Helm repository exists.

    helm repo list | grep virtnest
    

    If the result is empty or shows the following message, proceed to the next step. Otherwise, skip the next step.

    Error: no repositories to show
    
  2. Add the Virtual Machine Helm repository.

    helm repo add virtnest http://{harbor url}/chartrepo/{project}
    
  3. Update the Virtual Machine Helm repository.

    helm repo update virtnest # (1)
    
    1. If the helm version is too low, it may fail. If it fails, try executing helm update repo.
  4. Choose the version of the Virtual Machine you want to install (it is recommended to install the latest version).

    helm search repo virtnest/virtnest --versions
    
    [root@master ~]# helm search repo virtnest/virtnest --versions
    NAME                   CHART VERSION  APP VERSION  DESCRIPTION
    virtnest/virtnest  0.2.0          v0.2.0       A Helm chart for virtnest
    ...
    
  5. Back up the --set parameters.

    Before upgrading the Virtual Machine version, it is recommended to run the following command to backup the --set parameters of the previous version.

    helm get values virtnest -n virtnest-system -o yaml > bak.yaml
    
  6. Update the virtnest CRDs.

    helm pull virtnest/virtnest --version 0.2.0 && tar -zxf virtnest-0.2.0.tgz
    kubectl apply -f virtnest/crds
    
  7. Run helm upgrade.

    Before upgrading, it is recommended to replace the global.imageRegistry field in bak.yaml with the current container registry address.

    export imageRegistry={your container registry}
    
    helm upgrade virtnest virtnest/virtnest \
      -n virtnest-system \
      -f ./bak.yaml \
      --set global.imageRegistry=$imageRegistry \
      --version 0.2.0
    
  1. Back up the --set parameters.

    Before upgrading the Virtual Machine version, it is recommended to run the following command to backup the --set parameters of the previous version.

    helm get values virtnest -n virtnest-system -o yaml > bak.yaml
    
  2. Update the virtnest CRDs.

    kubectl apply -f ./crds
    
  3. Run helm upgrade.

    Before upgrading, it is recommended to replace the global.imageRegistry field in bak.yaml with the current container registry address.

    export imageRegistry={your container registry}
    
    helm upgrade virtnest . \
      -n virtnest-system \
      -f ./bak.yaml \
      --set global.imageRegistry=$imageRegistry
    

Comments