Raven

    假设你已经有了一个边缘kubernetes集群,节点分布在不同的物理区域,并且已经在这个集群中部署了,有关Raven Controller Manager的详细信息在这里可以找到。

    我们对位于不同物理(网络)区域节点,分别使用一个Gateway CR来进行管理。通过给节点打标的方式,来标识节点由哪个Gateway管理。

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

    同样地,我们分别为位于云端节点和cn-huhehaote的节点打上gw-cloudgw-wlcb的标签。

    1. $ kubectl label nodes master raven.openyurt.io/gateway=gw-cloud
    2. master labeled
    1. git clone https://github.com/openyurtio/raven.git
    2. cd raven
    3. make deploy

    运行如下命令,检查相应的Raven Agent的Pod是否成功运行。

    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

    2. 如何使用

    • 创建的Gateway CR
    • 查看各个Gateway CR的状态
    1. $ kubectl get gateways
    2. NAME ACTIVEENDPOINT
    3. gw-hhht hhht-node1
    4. gw-master master
    5. gw-wlcb wlcb-node1
    • 创建测试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. metadata:
    15. spec:
    16. nodeName: wlcb-node2
    17. containers:
    18. - name: fedora
    19. image: njucjc/fedora:latest
    20. imagePullPolicy: Always
    21. EOF
    • 确定测试Pod正常运行
    • 测试跨网络域的Pod网络联通
    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