Add network reachability detection from host for the VLAN network

  • Related issue: #1476 Add network reachability detection from host for the VLAN network

Category:

  • Network

Environment Setup

  • The network environment must have vlan network configured and also have DHCP server prepared on your testing vlan

Verification Steps

  1. Enable virtual network with harvester-mgmt in harvester
  2. Create VLAN 806 with id 806 and set to default auto mode
  3. Import harvester to rancher 1 .Create cloud credential
  4. Provision a rke2 cluster to harvester image

image

  1. Deploy a nginx server workload image

image

  1. Open Service Discover -> Services

  2. Create a Load Balancer service image

  3. Provide service port image

  4. Provide health check port image

  5. Edit yaml on nginx workload , copy the lable key value pair image

  6. Open Selectors tab in loadbalncer

  7. Paste the key value pair from nginx image

image

  1. Open Cluster -> Nodes

  2. Access the RKE2 nodes image

  3. Click the Download SSH key

  4. unzip the ssh key

  5. Run `ssh -i <id_rsa> to login rke2 cluster

  6. Access RKE2 cluster https://docs.rancher.cn/docs/rke2/cluster_access/_index/

  7. Run ./kubectl get svc

  8. ssh to harvester node 1

  9. Run kubectl get endpointslice -o wide

  10. Run `curl http://{nigix endpoint ip}

  11. Run `curl http://{loadbalcner external ip}

Expected Results

Currently can access nginx deployment and loadbalancer from harvester node.

Access rke2-cluster nodes

hpd8s7:/home/rancher # kubectl get endpointslice -o wide
NAME                                    ADDRESSTYPE   PORTS   ENDPOINTS                                AGE
kubernetes                              IPv4          6443    10.84.44.114,10.84.44.115,10.84.44.116   44h
kubernetes-default-nginx-lb2-3e4eb608   IPv4          30905   10.84.45.115                             27h
kubernetes-default-ngnix-lb-616792a7    IPv4          30904   10.84.45.115
hpd8s7:/home/rancher # curl http://10.84.44.115
<a href="https://10.84.44.115/">Found</a>.

Access loadbalancer on rke2-cluster

root@rke2-cluster-pool1-bde93828-k7fzs:/var/lib/rancher/rke2/bin# ./kubectl get svc
NAME         TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)        AGE
kubernetes   ClusterIP      10.43.0.1      <none>         443/TCP        29h
nginx-lb2    LoadBalancer   10.43.87.126   10.84.45.117   80:30905/TCP   27h
ngnix-lb     LoadBalancer   10.43.61.34    10.84.45.116   80:30904/TCP   29h