k8s 集群、整体使用calico网络,对有rsf服务调用的服务,使用macvlan网络

一 实现方法

给node 打标签,然后更改这台node上配置

1.1 vim /etc/kubernetes/kubelet

KUBELET_ARGS="--network-plugin=cni --cni-conf-dir=/etc/cni/net.d/macvlan --cni-bin-dir=/opt/cni/bin --bootstrap-kubeconfig=/etc/kubernetes/bootstrap.kubeconfig --kubeconfig=/etc/kubernetes/kubelet.kubeconfig --config=/etc/kubernetes/kubelet.config --cert-dir=/etc/kubernetes/ssl"

更改--cni-conf-dir= 到macvlan配置文件路径下

1.2 下载cni 插件

https://github.com/containernetworking/plugins

releases 下面选择对应版本的amd64版本

https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz

1.3 解压后吧二进制文件cp到/opt/cni/bin/下面

cp * /opt/cni/bin/

1.4 编写macvlan配置文件

cd /etc/cni/net.d/macvlan/

vim 10-macvlannet.conf

{

"name": "macvlannet",

"type": "macvlan",

"master": "bond0",

"mode": "vepa",

"isGateway": true,

"ipMasq": true,

"ipam": {

    "type": "host-local",

    "subnet": "10.8.1.0/24",

    "rangeStart": "10.8.1.100",

    "rangeEnd": "10.8.1.120",

    "gateway": "10.8.1.1",

    "routes": \[

        { "dst": "0.0.0.0/0" }

    \]

},

"dns": {

    "nameservers": \["10.7.3.22", "192.168.50.235", "117.50.32.157", "202.106.0.20", "8.8.8.8"\],

    "search": \["docker.hc360.com", "hc360.com"\]

}

}

二 macvlan上的pod 无法ping通本机实体机,所以kubernetes的 健康检查机制不可用

livenessProbe

readinessProbe 不可用

三 其他没有跑macvlan 的节点可以使用nodeport 访问macvlan机器上的服务

results matching ""

    No results matching ""