Raven
假设你已经有了一个边缘kubernetes集群,节点分布在不同的物理区域,并且已经在这个集群中部署了,有关Raven Controller Manager
的详细信息在这里可以找到。
我们对位于不同物理(网络)区域节点,分别使用一个Gateway CR来进行管理。通过给节点打标的方式,来标识节点由哪个Gateway管理。
$ kubectl label nodes hhht-node1 hhht-node2 raven.openyurt.io/gateway=gw-hhht
hhht-node1 labeled
hhht-node2 labeled
同样地,我们分别为位于云端节点和cn-huhehaote
的节点打上gw-cloud
和gw-wlcb
的标签。
$ kubectl label nodes master raven.openyurt.io/gateway=gw-cloud
master labeled
git clone https://github.com/openyurtio/raven.git
cd raven
make deploy
运行如下命令,检查相应的Raven Agent的Pod是否成功运行。
$ kubectl get pod -n kube-system | grep raven-agent-ds
raven-agent-ds-2jw47 1/1 Running 0 91s
raven-agent-ds-bq8zc 1/1 Running 0 91s
raven-agent-ds-cj7k4 1/1 Running 0 91s
raven-agent-ds-p9fk9 1/1 Running 0 91s
2. 如何使用
- 创建的Gateway CR
- 查看各个Gateway CR的状态
$ kubectl get gateways
NAME ACTIVEENDPOINT
gw-hhht hhht-node1
gw-master master
gw-wlcb wlcb-node1
- 创建测试Pod
$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: fedora-1
spec:
nodeName: hhht-node2
containers:
- name: fedora
image: njucjc/fedora:latest
imagePullPolicy: Always
---
apiVersion: v1
metadata:
spec:
nodeName: wlcb-node2
containers:
- name: fedora
image: njucjc/fedora:latest
imagePullPolicy: Always
EOF
- 确定测试Pod正常运行
- 测试跨网络域的Pod网络联通
$ kubectl exec -it fedora-1 -- bash
[root@fedora-1]# ping 10.14.2.70 -c 4
PING 10.14.2.70 (10.14.2.70) 56(84) bytes of data.
64 bytes from 10.14.2.70: icmp_seq=1 ttl=60 time=32.2 ms
64 bytes from 10.14.2.70: icmp_seq=2 ttl=60 time=32.2 ms
64 bytes from 10.14.2.70: icmp_seq=3 ttl=60 time=32.0 ms
64 bytes from 10.14.2.70: icmp_seq=4 ttl=60 time=32.1 ms
--- 10.14.2.70 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms