Raven

This document introduces how to install raven and use raven to enhance edge-edge and edge-cloud network communication in an edge cluster.

Suppose you have an edge kubernetes cluster with nodes in different physical regions, and already deploy the Raven Controller Manager in this cluster, the details of Raven Controller Manager are in here.

Label nodes in different physical regions

As follows, suppose the cluster has five nodes, located in three different regions, where the node master is cloud node.

  1. $ kubectl get nodes -o wide
  2. NAME STATUS ROLES AGE VERSION INTERNAL-IP
  3. hhht-node1 Ready <none> 20d v1.16.2 10.48.115.9
  4. hhht-node2 Ready <none> 20d v1.16.2 10.48.115.10
  5. master Ready master 20d v1.16.2 10.48.115.8
  6. wlcb-node1 Ready <none> 20d v1.16.2 10.48.115.11
  7. wlcb-node2 Ready <none> 20d v1.16.2 10.48.115.12

We use a Gateway CR to manage nodes in different physical regions, and label nodes to indicate which Gateway these nodes are managed by.

For example, We label nodes in region cn-huhehaote with value gw-hhht, indicating that these nodes are managed by the gw-hhht gateway.

  1. $ kubectl label nodes hhht-node1 hhht-node2 raven.openyurt.io/gateway=gw-hhht
  2. hhht-node1 labeled
  3. hhht-node2 labeled

Similarly, we label node in cloud with value gw-cloud, and nodes in region cn-wulanchabu with value gw-wlcb.

  1. $ kubectl label nodes master raven.openyurt.io/gateway=gw-cloud
  2. master labeled
  1. $ kubectl label nodes wlcb-node1 wlcb-node2 raven.openyurt.io/gateway=gw-wlcb
  2. wlcb-node1 labeled
  3. wlcb-node2 labeled

install raven agent

  1. git clone https://github.com/openyurtio/raven.git
  2. cd raven
  3. make deploy

Wait for the raven agent daemon to be created successfully

  1. $ kubectl get pod -n kube-system | grep raven-agent-ds
  2. raven-agent-ds-2jw47 1/1 Running 0 91s
  3. raven-agent-ds-bq8zc 1/1 Running 0 91s
  4. raven-agent-ds-cj7k4 1/1 Running 0 91s
  5. raven-agent-ds-p9fk9 1/1 Running 0 91s
  6. raven-agent-ds-rlb9q 1/1 Running 0 91s

How to Use

Gateways

  • create gateways
  1. $ cat <<EOF | kubectl apply -f -
  2. apiVersion: raven.openyurt.io/v1alpha1
  3. kind: Gateway
  4. metadata:
  5. name: gw-hhht
  6. spec:
  7. endpoints:
  8. - nodeName: hhht-node1
  9. underNAT: true
  10. - nodeName: hhht-node2
  11. underNAT: true
  12. ---
  13. apiVersion: raven.openyurt.io/v1alpha1
  14. kind: Gateway
  15. metadata:
  16. name: gw-cloud
  17. spec:
  18. endpoints:
  19. - nodeName: master
  20. underNAT: false
  21. ---
  22. apiVersion: raven.openyurt.io/v1alpha1
  23. kind: Gateway
  24. metadata:
  25. name: gw-wlcb
  26. spec:
  27. endpoints:
  28. - nodeName: wlcb-node1
  29. underNAT: true
  30. - nodeName: wlcb-node2
  31. underNAT: true
  32. EOF
  • Get gateways
  1. $ kubectl get gateways
  2. NAME ACTIVEENDPOINT
  3. gw-hhht hhht-node1
  4. gw-master master
  5. gw-wlcb wlcb-node1

Test pod-to-pod networking

  • Create test pod
  1. $ cat <<EOF | kubectl apply -f -
  2. apiVersion: v1
  3. kind: Pod
  4. metadata:
  5. name: fedora-1
  6. spec:
  7. nodeName: hhht-node2
  8. containers:
  9. - name: fedora
  10. image: njucjc/fedora:latest
  11. imagePullPolicy: Always
  12. ---
  13. apiVersion: v1
  14. kind: Pod
  15. metadata:
  16. name: fedora-2
  17. spec:
  18. nodeName: wlcb-node2
  19. containers:
  20. - name: fedora
  21. image: njucjc/fedora:latest
  22. imagePullPolicy: Always
  23. EOF
  • Get test pod
  1. $ kubectl get pod -o wide
  2. NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
  3. fedora-1 1/1 Running 0 46s 10.14.10.67 hhht-node2 <none> <none>
  4. fedora-2 1/1 Running 0 46s 10.14.2.70 wlcb-node2 <none> <none>
  • Test networking across edge
  1. $ kubectl exec -it fedora-1 -- bash
  2. [root@fedora-1]# ping 10.14.2.70 -c 4
  3. PING 10.14.2.70 (10.14.2.70) 56(84) bytes of data.
  4. 64 bytes from 10.14.2.70: icmp_seq=1 ttl=60 time=32.2 ms
  5. 64 bytes from 10.14.2.70: icmp_seq=2 ttl=60 time=32.2 ms
  6. 64 bytes from 10.14.2.70: icmp_seq=3 ttl=60 time=32.0 ms
  7. 64 bytes from 10.14.2.70: icmp_seq=4 ttl=60 time=32.1 ms
  8. --- 10.14.2.70 ping statistics ---
  9. 4 packets transmitted, 4 received, 0% packet loss, time 3003ms
  10. rtt min/avg/max/mdev = 32.047/32.136/32.246/0.081 ms