Air-Gap Install for RKE-2 Kubernetes
To deploy RKE-2 Kubernetes in an air-gap environment, we will have to collect and archive the deployment artifacts from a system where internet is available.
Collect Artifacts for RKE2
Identify latest stable release for RKE2. Navigate to the latest stable release page on github using RKE-2 stable release. At the time of this writing the latest stable release is v1.28.12+rke2r1
Create a local artifacts folder
mkdir /root/artifacts/rke2 && cd /root/artifacts/rke2
Download RKE2 artifacts
curl -OLs https://github.com/rancher/rke2/releases/download/v1.28.12%2Brke2r1/rke2-images.linux-amd64.tar.zst
curl -OLs https://github.com/rancher/rke2/releases/download/v1.28.12%2Brke2r1/rke2.linux-amd64.tar.gz
curl -OLs https://github.com/rancher/rke2/releases/download/v1.28.12%2Brke2r1/sha256sum-amd64.txt
curl -sfL https://get.rke2.io --output install.sh
Create a folder for EFCX artifacts
mkdir /root/artifacts/EFCX && /root/artifacts/EFCX
Downloads and archive other helm charts
Openebs
helm repo add openebs https://openebs.github.io/openebs
helm repo update
helm pull openebs/openebs
Download images for openebs
mkdir -p images/openebs
for OPENEBS_IMG in $(helm template --debug openebs/openebs|& awk '/image:/ {print $2 }' |sed -e "s/'//g" -e 's/"//g'|sort -u)
do
OPENEBS_IMG_IMAGE_REPO=${OPENEBS_IMG%%:*};
echo "${OPENEBS_IMG_IMAGE_REPO}"
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock /var/lib/rancher/rke2/bin/ctr -n k8s.io i pull docker.io/${OPENEBS_IMG}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i export images/openebs/${OPENEBS_IMG_IMAGE_REPO//\//}.tar docker.io/${OPENEBS_IMG}
done
Cert-manager
mkdir images/cert-manager
for CERT_M_IMG in $(helm template --debug --set installCRDs=true oci://registry-1.docker.io/bitnamicharts/cert-manager|& awk '/image:/ {print $2 }' |sed -e "s/'//g" -e 's/"//g'|sort -u)
do
CERT_M_IMAGE_REPO=${CERT_M_IMG%%:*};
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock /var/lib/rancher/rke2/bin/ctr -n k8s.io i pull ${CERT_M_IMG}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i export images/cert-manager/${CERT_M_IMAGE_REPO//\//}.tar ${CERT_M_IMG}
done
Clone the CX repository ( replace the branch-name )
git clone -b <BRANCH-NAME> https://efcx:RecRpsuH34yqp56YRFUb@gitlab.expertflow.com/cim/cim-solution.git
Download all the CX solution images
mkdir images/efcx
for CXI in $(awk '/[ ]+image:/ { print $NF }' cim-solution/kubernetes/cim/Deployments/*.yaml)
do
CXI_IMAGE_REPO=${CXI%%:*};
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock /var/lib/rancher/rke2/bin/ctr -n k8s.io i pull -u efcx:RecRpsuH34yqp56YRFUb ${CXI}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i export images/efcx/${CXI_IMAGE_REPO//\//}.tar ${CXI}
done
Download and archive images for External Components
mkdir images/efex
IMG_ARRAY=()
for efex in cim-solution/kubernetes/external/bitnami/*
do
IMG_ARRAY+=($(helm template --debug --values ${efex}/values.yaml ${efex}|awk '/image:/ { print $2 }'))
done
#Archive
for img in "$IMG_ARRAY[@]}"
do
EFCX_IMAGE_REPO=${img%%:*};
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock /var/lib/rancher/rke2/bin/ctr -n k8s.io i pull ${img}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i export images/efex/${EFCX_IMAGE_REPO//\//}.tar ${img}
done
Rasa-x Images
mkdir images/rasax
for RASAX_IMAGE in $(helm template --debug --values cim-solution/kubernetes/external/rasa-x/values-small.yaml cim-solution/kubernetes/external/rasa-x 2> /dev/null |awk '/image:/ {print $2 }'|sed -e "s/'//g" -e 's/"//g'|sort -u )
do
RASAX_IMAGE_REPO=${RASAX_IMAGE%%:*}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock /var/lib/rancher/rke2/bin/ctr -n k8s.io i pull ${RASAX_IMAGE}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i export images/rasax/${RASAX_IMAGE_REPO//\//}.tar ${RASAX_IMAGE}
done
Superset Images
mkdir images/superset
for SUPERSET_IMAGE in $(helm template --debug --values cim-solution/kubernetes/external/superset/values.yaml cim-solution/kubernetes/external/superset 2> /dev/null |awk '/image:/ {print $2 }'|sed -e "s/'//g" -e 's/"//g'|sort -u )
do
SUPERSET_IMAGE_REPO=${SUPERSET_IMAGE%%:*}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock /var/lib/rancher/rke2/bin/ctr -n k8s.io i pull ${SUPERSET_IMAGE}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i export images/superset/${SUPERSET_IMAGE_REPO//\//}.tar ${SUPERSET_IMAGE}
done
Download the latest helm binary
Identify the latest release by visiting the link. As of this writing, the latest release is v3.15.4 ( change with the latest release in below given steps. )
wget https://get.helm.sh/helm-v3.15.4-linux-amd64.tar.gz
Change to the /root/ directory
cd /root/
Archive all the artifacts
tar cvf rke2-EFCX-artifacts.tar /root/artifacts
Transfer all the artifacts to Offline system ( s/ftp, USB or using Jump PC )
On the target system( without internet access)
Once all the files from previous steps are copied/transferred, use below given procedure
Extract the archive
tar zxvf rke2-EFCX-artifacts.tar
Install RKE2 using air-gap method
cd artifacts/rke2
INSTALL_RKE2_ARTIFACT_PATH=/root/artifacts/rke2 INSTALL_RKE2_METHOD=tar sh install.sh
Create necessary files as mentioned in the standard deployment guide for RKE2 config.yaml and other manifests before proceeding with the RKE2 install as mentioned here
It takes a while for RKE2 to completely ready, please wait while all the pods are in running state.
Install helm
Change to the directory where artifacts are extracted
cd /root/artifacts
Extract the helm archine
tar zxvf helm-v3.15.4-linux-amd64.tar.gz
and copy the binary
cp linux-amd64/helm /usr/local/bin/
Once RKE2 is up and running, proceed with the import process of images
Import OpenEBS images
for img in EFCX/images/openebs/*.tar
do
echo ${img}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i import ${img}
done
Import cert-manager
for img in EFCX/images/cert-manager/*.tar
do
echo ${img}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i import ${img}
done
Import EFCX images
for img in EFCX/images/efcx/*.tar
do
echo ${img}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i import ${img}
done
Import external component images
for img in EFCX/images/efex/*.tar
do
echo ${img}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i import ${img}
done
Import superset images
for img in EFCX/images/superset/*.tar
do
echo ${img}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i import ${img}
done
Import rasa-x images
for img in EFCX/images/rasax/*.tar
do
echo ${img}
CONTAINERD_ADDRESS=/run/k3s/containerd/containerd.sock ctr -n k8s.io i import ${img}
done
View all the images are imported successfully
crictl --runtime-endpoint="unix:///run/k3s/containerd/containerd.sock" image list
Next Steps
Proceed with the EF-CX installation using CX Deployment on Kubernetes