Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
external-header-nav
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Pull Kubevirt Images and Deploy Kubevirt Using a Local Registry

date_range 20-Apr-23
The current Kubevirt release (v0.58.0) doesn't support imagePullSecret. This field-located in a Kubernetes configuration file-tells Kubernetes where to pull credentials from in order to pull images from a secure registry (enterprise-hub.juniper.net/contrail-container-prod/). Juniper Cloud-Native Contrail® Networking™ (CN2) release 22.4 addresses this issue with a workaround for the older Kubevirt release (v048.0) and current release (v0.58.0).
See the following information about how to perform this workaround to pull images and deploy Kubevirt using a local registry.
  1. Install Docker.

    content_copy zoom_out_map
    sudo curl -fsSL https://get.docker.com -o /tmp/get-docker.sh
    sudo sh /tmp/get-docker.sh
  2. Create a local registry.

    content_copy zoom_out_map
    sudo docker run -d -p 5000:5000 --restart=always --name registry registry:2
  3. Edit /etc/docker/daemon.json to add your local registry's ip:port.

    content_copy zoom_out_map
    # add the following to /etc/docker/daemon.json
    #
    #{
    #  "local-registries" : ["your-computer-hostname:5000"]
    #}
  4. Restart Docker.

    content_copy zoom_out_map
    sudo service docker restart
  5. Download the required containers. These containers are located at Release Userspace CNI - dpdk vhostuser interface support Juniper/kubevirt. The kubevirt-operator.yaml and kubevirt-cr.yaml are also located at this repository.

    content_copy zoom_out_map
    sudo wget -O /tmp/virt-api_v0.58.0-jnpr.tar.gz https://github.com/Juniper/kubevirt/releases/download/v0.58.0-jnpr/virt-api_v0.58.0-jnpr.tar.gz
    sudo wget -O /tmp/virt-controller_v0.58.0-jnpr.tar.gz https://github.com/Juniper/kubevirt/releases/download/v0.58.0-jnpr/virt-controller_v0.58.0-jnpr.tar.gz
    sudo wget -O /tmp/virt-handler_v0.58.0-jnpr.tar.gz https://github.com/Juniper/kubevirt/releases/download/v0.58.0-jnpr/virt-handler_v0.58.0-jnpr.tar.gz
    sudo wget -O /tmp/virt-launcher_v0.58.0-jnpr.tar.gz https://github.com/Juniper/kubevirt/releases/download/v0.58.0-jnpr/virt-launcher_v0.58.0-jnpr.tar.gz
    sudo wget -O /tmp/virt-operator_v0.58.0-jnpr.tar.gz https://github.com/Juniper/kubevirt/releases/download/v0.58.0-jnpr/virt-operator_v0.58.0-jnpr.tar.gz
  6. Load the required containers.

    content_copy zoom_out_map
    sudo docker load < /tmp/virt-api_v0.58.0-jnpr.tar.gz
    sudo docker load < /tmp/virt-controller_v0.58.0-jnpr.tar.gz
    sudo docker load < /tmp/virt-handler_v0.58.0-jnpr.tar.gz
    sudo docker load < /tmp/virt-launcher_v0.58.0-jnpr.tar.gz
    sudo docker load < /tmp/virt-operator_v0.58.0-jnpr.tar.gz
  7. Tag and push the containers to your local registry.

    Replace <LOCAL_REGISTRY> with your local registry. For example, if the containers are hosted at 10.84.13.52:5000/kubevirt, replace <LOCAL_REGISTRY> with 10.84.13.52:5000/kubevirt.

    content_copy zoom_out_map
    sudo docker tag svl-artifactory.juniper.net/atom-docker/kubevirt/virt-api:v0.58.0-jnpr <LOCAL_REGISTRY>/virt-api:v0.58.0-jnpr
    sudo docker push <LOCAL_REGISTRY>/virt-api:v0.58.0-jnpr
    sudo docker tag svl-artifactory.juniper.net/atom-docker/kubevirt/virt-controller:v0.58.0-jnpr <LOCAL_REGISTRY>/virt-controller:v0.58.0-jnpr
    sudo docker push <LOCAL_REGISTRY>/virt-controller:v0.58.0-jnpr
    sudo docker tag svl-artifactory.juniper.net/atom-docker/kubevirt/virt-handler:v0.58.0-jnpr <LOCAL_REGISTRY>/virt-handler:v0.58.0-jnpr
    sudo docker push <LOCAL_REGISTRY>/virt-handler:v0.58.0-jnpr
    sudo docker tag svl-artifactory.juniper.net/atom-docker/kubevirt/virt-launcher:v0.58.0-jnpr <LOCAL_REGISTRY>/virt-launcher:v0.58.0-jnpr
    sudo docker push <LOCAL_REGISTRY>/virt-launcher:v0.58.0-jnpr
    sudo docker tag svl-artifactory.juniper.net/atom-docker/kubevirt/virt-operator:v0.58.0-jnpr <LOCAL_REGISTRY>/virt-operator:v0.58.0-jnpr
    sudo docker push <LOCAL_REGISTRY>/virt-operator:v0.58.0-jnpr
  8. Download the kubevirt-operator.yaml and kubevirt-cr.yaml.

    content_copy zoom_out_map
    wget https://github.com/Juniper/kubevirt/releases/download/v0.58.0-jnpr/kubevirt-operator.yaml
    wget https://github.com/Juniper/kubevirt/releases/download/v0.58.0-jnpr/kubevirt-cr.yaml
  9. Modify the kubevirt-operator.yaml.

    Replace <LOCAL_REGISTRY> with your local registry. For example, if the containers are hosted at 10.84.13.52:5000/kubevirt, replace <LOCAL_REGISTRY> with 10.84.13.52:5000/kubevirt.

  10. Modify /etc/crio/crio.conf in all Kubernetes nodes in the cluster. Add the following to the crio.conf in all of the Kubernetes nodes in the cluster. These commands allow cri-o (Container Runtime Interface-Open Container Initiative) to pull images from your local registry.

    Note:

    The cri-o service is a version of the Kubernetes container runtime interface (CRI) that enables the use of Open Container Initiative (OCI) compatible runtimes.

    content_copy zoom_out_map
    insecure_registries = ["10.92.81.91/22"]
                registries = ["10.92.81.91:5000"]
                
                Where 10.92.81.91 is the ip of <LOCAL_REGISTRY>
  11. After modifying the crio.conf, restart the service.

    content_copy zoom_out_map
    service crio restart
external-footer-nav