57-Import airgapped harvester from airgapped rancher with Proxy

  • Related task: #1052 Test Air gap with Rancher integration

Environment Setup

Setup the airgapped harvester

  1. Fetch ipxe vagrant example with new offline feature https://github.com/harvester/ipxe-examples/pull/32
  2. Edit the setting.xml file
  3. Set offline: true
  4. Use ipxe vagrant example to setup a 3 nodes cluster
  5. Enable vlan on harvester-mgmt
  6. Now harvester dashboard page will out of work
  7. Create virtual machine with name vlan1 and id: 1
  8. Open Settings, edit http-proxy with the following values
HTTP_PROXY=http://proxy-host:port
HTTPS_PROXY=http://proxy-host:port
NO_PROXY=localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,192.168.0.0/16,cattle-system.svc,.svc,.cluster.local,<internal domain>

image

  1. Create ubuntu cloud image from URL
  2. Create virtual machine and assign vlan network, confirm can get ip address

Setup squid HTTP proxy server

  1. When you enabled offline in vagrant example, you don’t need to install squid http proxy

Setup the airgapped harvester

  1. Create an ubuntu virtual machine on localhost machine
  2. Assign harvester and vagrant-libvirt network to the virtual machine
  3. Run curl -fsSL https://get.docker.com | bash to install docker
  4. Pull latest rancher image docker pull rancher/rancher:2.6.3-rc6
  5. Run rancher container by command:
$sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 \
-e HTTP_PROXY="http://192.168.0.254:3128" \
-e HTTPS_PROXY="http://192.168.0.254:3128" \
-e NO_PROXY="localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,cattle-system.svc,192.168.0.0/16,.svc,.cluster.local,example.com" \
--privileged rancher/rancher:v2.6.3-rc6
  1. Login rancher and set access url
  2. Set the following in Advanced - user data in the create RKE2 cluster page
#cloud-config
apt:
  http_proxy: http://192.168.0.254:3128
  https_proxy: http://192.168.0.254:3128

image

  1. In Cluster Configuration - Agent Environment Vars, add the following
HTTP_PROXY: http://192.168.0.254:3128
HTTPS_PROXY: http://192.168.0.254:3128
NO_PROXY: localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,cattle-system.svc,.svc,.cluster.local

image

  1. Create 4 core, 8GB RKE2 cluster in harvester

Test steps

  1. Follow steps in 01-Import existing Harvester clusters in Rancher to import harvester
  2. Follow steps in 22-Create RKE2 Kubernetes Cluster to provision RKE2 cluster

Expected Results

  1. Can import harvester from Rancher correctly
  2. Can access downstream harvester cluster from Rancher dashboard
  3. Can provision at least one node RKE2 cluster to harvester correctly with running status
  4. Can explore provisioned RKE2 cluster nodes
  5. RKE2 cluster VM created running correctly on harvester node