Pull Kubevirt Images and Deploy Kubevirt Using a Local Registry
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). -
Install Docker.
sudo curl -fsSL https://get.docker.com -o /tmp/get-docker.sh sudo sh /tmp/get-docker.sh
-
Create a local registry.
sudo docker run -d -p 5000:5000 --restart=always --name registry registry:2
-
Edit
/etc/docker/daemon.json
to add your local registry'sip:port
.# add the following to /etc/docker/daemon.json # #{ # "local-registries" : ["your-computer-hostname:5000"] #}
-
Restart Docker.
sudo service docker restart
-
Download the required containers. These containers are located at Release Userspace CNI - dpdk vhostuser interface support Juniper/kubevirt. The
kubevirt-operator.yaml
andkubevirt-cr.yaml
are also located at this repository.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
-
Load the required containers.
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
-
Tag and push the containers to your local registry.
Replace
<LOCAL_REGISTRY>
with your local registry. For example, if the containers are hosted at10.84.13.52:5000/kubevirt
, replace<LOCAL_REGISTRY>
with10.84.13.52:5000/kubevirt
.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
-
Download the
kubevirt-operator.yaml
andkubevirt-cr.yaml
.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
-
Modify the
kubevirt-operator.yaml
.Replace
<LOCAL_REGISTRY>
with your local registry. For example, if the containers are hosted at10.84.13.52:5000/kubevirt
, replace<LOCAL_REGISTRY>
with10.84.13.52:5000/kubevirt
. -
Modify
/etc/crio/crio.conf
in all Kubernetes nodes in the cluster. Add the following to thecrio.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.
insecure_registries = ["10.92.81.91/22"] registries = ["10.92.81.91:5000"] Where 10.92.81.91 is the ip of <LOCAL_REGISTRY>
-
After modifying the
crio.conf
, restart the service.service crio restart