61. 如何在 RKE/RKE2 集群中配置 Calico 节点 IP 自动检测
环境访问Rancher-K8S解决方案博主 https://blog.csdn.net/lidw2009A Rancher-provisioned or standalone RKE/RKE2 cluster using the Calico CNI.一个使用 Calico CNI 的 Rancher 配置或独立的 RKE/RKE2 集群。Kubernetes cluster nodes with multiple network interfaces or interfaces configured with multiple addresses.Kubernetes 集群节点拥有多个网络接口或配置为多个地址的接口。情况Calico uses a single IPv4 (and/or an IPv6 address if running a dual-stack or IPv6 only cluster) per node to route pod traffic between nodes. By default, Calico selects the first address on the first valid interface, using the first-found autodetection method.Calico 每个节点使用单一 IPv4或如果运行双栈或仅 IPv6 集群则使用一个 IPv6 地址来路由节点间的 Pod 流量。默认情况下Calico 会使用 “先发现” 自动检测方法 在第一个有效接口上选择第一个地址。In environments with multiple network interfaces on cluster nodes, or multiple addresses on a single interface, this may result in selection of an address that prevents successful routing of pod traffic between some or all nodes in the cluster.在集群节点上有多个网络接口或单个接口上有多个地址的环境中这可能导致选择一个地址从而阻碍集群中部分或全部节点之间 pod 流量的成功路由。To prevent this, the method used to determine the network interface used by Calico can be specified, per the Calico documentation.为了防止这种情况可以根据 Calico 文档指定确定 Calico 所用网络接口的方法。For example, theinterfaceparameter can be used to select a specific network interface by name, orcidrcan be used to specify CIDRs from which an address on the node should be selected.例如接口参数可用于通过名称选择特定的网络接口或使用cidr指定节点地址应从中选择的 CIDR。解决方案In the examples below, theinterfaceautodetection method is configured so that Calico selects the address from the interface namedens192.在下面的示例中接口自动检测方法配置为 Calico 从名为ens192的接口中选择地址。RKE2Rancher-provisioned RKE2 clusters牧场配置 RKE2 集群In a Rancher-provisioned RKE2 cluster, you can specify the Calico autodetection method via the cluster add-on configuration:在 Rancher 配置的 RKE2 集群中您可以通过集群附加组件配置指定 Calico 自动检测方法Navigate toCluster Managementwithin the Rancher UI.在 Rancher 界面中进入集群管理。ClickEdit Configfor the desired RKE2 cluster.点击编辑配置以获取所需的 RKE2 集群。UnderCluster ConfigurationclickAdd-on: Calico.在集群配置中点击“附加组件Calico”。Enter the desired autodetection method(s) into the calicoNetwork block. In the example below, the IPv4 autodetection method is set tointerface: ens192.将所需的自动检测方法输入到 calicoNetwork 模块中。在下面的示例中IPv4 自动检测方法设置为接口ens192。span stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#f3f3f3affinity: {} apiServer: enabled: false calicoctl: image: rancher/mirrored-calico-ctl tag: v3.28.1 [...] installation: [...] calicoNetwork: nodeAddressAutodetectionV4: interface: ens192 [...]/span/span/spanStandalone RKE2 clusters 独立 RKE2 集群In a standalone RKE2 cluster, you can specify the Calico autodetection method via a HelmChartConfig resource.在独立的 RKE2 集群中你可以通过 HelmChartConfig 资源指定 Calico 自动检测方法。Write the HelmChartConfig to a file in the manifests directory on the cluster controlplane nodes (i.e. /var/lib/rancher/rke2/server/manifests/rke2-calico-config.yaml).将 HelmChartConfig 写入 clustercontrolplane 节点的 manifests 目录文件例如 /var/lib/rancher/rke2/server/manifests/rke2-calico-config.yaml。In the example below, the IPv4 autodetection method is set tointerface: ens192.在下面的示例中IPv4 自动检测方法设置为接口ens192。span stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#f3f3f3apiVersion: a>RKEIn RKE, you can specify the Calico autodetection method by creating a ConfigMap kubernetes-services-endpoint, in the kube-system namespace, using the field IP_AUTODETECTION_METHOD (and IP6_AUTODETECTION_METHOD for IPv6).在 RKE 中你可以通过在 kube 系统命名空间中创建 ConfigMap kubernetes-services-endpoint使用字段 IP_AUTODETECTION_METHODIPv6 的字段 IP6_AUTODETECTION_METHOD来指定 Calico 自动检测方法。In the example below, the IPv4 autodetection method is set tointerface: ens192.在下面的示例中IPv4 自动检测方法设置为接口ens192。span stylecolor:#000000span stylebackground-color:#ffffffspan stylebackground-color:#f3f3f3apiVersion: v1 kind: ConfigMap metadata: name: kubernetes-services-endpoint namespace: kube-system data: IP_AUTODETECTION_METHOD: interfaceens192/span/span/span
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2422709.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!