容器服务ACK之前创建的集群,只添加了深圳E可用区的交换机,现在想把深圳ABCDF的交换机都加进去

(图片来源网络,侵删)

在容器服务ACK(阿里云容器服务Kubernetes版)中,我们可以使用VPC网络插件来管理集群的网络,当我们创建一个集群时,可以选择一个或多个可用区,并为每个可用区选择一个交换机,如果我们在创建集群时只添加了一个可用区的交换机,那么在后续的使用过程中,我们可能会发现需要将其他可用区的交换机也加入到集群中,本文将介绍如何在容器服务ACK中将深圳ABCDF的交换机都加进之前创建的集群。

1. 了解VPC网络插件

在容器服务ACK中,VPC网络插件是一个可选的网络插件,它允许我们在创建集群时选择自定义的VPC和交换机,通过使用VPC网络插件,我们可以为集群提供更灵活的网络配置。

2. 查看当前集群的网络配置

在开始操作之前,我们需要先查看当前集群的网络配置,可以通过以下命令查看:

kubectl get svc n kubesystem

这个命令会显示当前集群中所有与网络相关的服务,包括负载均衡器、Ingress控制器等,从这些服务的输出中,我们可以了解到当前集群使用的网络插件、网络策略等信息。

3. 修改集群的网络配置

要为集群添加新的交换机,我们需要修改集群的网络配置,我们需要获取当前集群的网络配置文件:

kubectl get cm n kubesystem kubeproxyconfig oyaml > kubeproxyconfig.yaml

我们需要编辑kubeproxyconfig.yaml文件,将spec.podSubnets字段中的cidrBlocks列表更新为包含新交换机CIDR的列表,如果深圳ABCDF的交换机CIDR分别为10.0.0.0/1610.1.0.0/1610.2.0.0/1610.3.0.0/1610.4.0.0/16,那么我们需要将这些CIDR添加到spec.podSubnets字段中:

apiVersion: v1kind: ConfigMapmetadata:  name: kubeproxyconfig  namespace: kubesystemdata:  config.yaml: |+    apiVersion: kubeproxy.config.k8s.io/v1alpha1    kind: KubeProxyConfiguration    mode: "ipvs"    ipvs:      scheduler: "rr"      strictARP: true      minSyncPeriod: 30s      maxSyncPeriod: 300s      resyncPeriod: 30s      failbackDelay: 30s      persistPeriod: 5m0s      syncPeriod: 30s      udpTimeoutMillis: 2ms      tcpTimeoutMillis: 45ms      congestionWindowBufSizeMB: 16      congestionWindowMultFactor: 2      expectedMasterCount: 1000000000      fastResyncThreshold: 5m0s      conntrackTimeoutMillis: 90ms      tcpCloseWaitTimeoutMillis: 3m0s      tcpEstablishedTimeoutMillis: 3m0s      tcpKeepaliveTimeMillis: 2m0s      tcpKeepaliveIntervalMillis: 75s      tcpFinTimeoutMillis: 5m0s      httpCheckFrequencySeconds: 60s      httpCheckMaxFailures: 3      httpCheckValidStatusCodes: "200399"      httpCheckPath: "/healthz"      inboundConnectionBufferBytes: 64kB      outboundConnectionBufferBytes: 64kB      streamIdleTimeoutSeconds: 30m0s      connectionTimeoutSeconds: 5m0s      readBufferSizeBytes: 128kB      writeBufferSizeBytes: 128kB      statsWriterIntervalSeconds: 30s      bindAddress: "" # IP of the node, e.g. "192.168.1.1" or "::1" (IPv6) or "auto" (use interface IP) or empty string for all interfaces (default)      metricsBindAddress: "" # IP of the node, e.g. "192.168.1.1" or "::1" (IPv6) or "auto" (use interface IP) or empty string for all interfaces (default)      healthzBindAddress: "" # IP of the node, e.g. "192.168.1.1" or "::1" (IPv6) or "auto" (use interface IP) or empty string for all interfaces (default)      enableProfiling: false # whether to enable prometheus profiler for this KubeProxy instance (default false)      disableContentionProfiling: false # whether to disable contention prometheus profiler for this KubeProxy instance (default false)      nodePortRangeMin: "" # minimum port number for NodePort service (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will be determined by the cluster CIDR and the default range is from 30000 to 32767, e.g. "32767" or "auto" or empty string for auto detection (default auto) if not set, it will是深圳ABCDF的交换机CIDR分别为`10.0.
相关文章