kubernetes - 如何在特定节点 Kubernetes 上更改 PODcidr
问题描述
我已经在裸机中设置了一个带有 kubeadm 的 kubernete 集群。
集群运行良好。
接下来我连接了一些工作节点。
但是由于某种原因,分配了 Pod 的其他 IP 地址。
现在,当您部署服务时,如果它安装在这些新节点之一上,则会出现错误。
错误 - “NetworkPlugin cni 未能设置 pod”
我不想做 init (kubeadm init --pod-network-cidr= ),原因很明显,我害怕破坏一切
我使用 Calico 作为 CNI 插件
/var/lib/kubelet/config.yaml:
address: 0.0.0.0
apiVersion: kubelet.config.k8s.io/v1beta1
authentication:
anonymous:
enabled: false
webhook:
cacheTTL: 2m0s
enabled: true
x509:
clientCAFile: /etc/kubernetes/ssl/ca.crt
authorization:
mode: Webhook
webhook:
cacheAuthorizedTTL: 5m0s
cacheUnauthorizedTTL: 30s
cgroupDriver: cgroupfs
cgroupsPerQOS: true
clusterDNS:
- 10.233.0.10
clusterDomain: cluster.local
configMapAndSecretChangeDetectionStrategy: Watch
containerLogMaxFiles: 5
containerLogMaxSize: 10Mi
contentType: application/vnd.kubernetes.protobuf
cpuCFSQuota: true
cpuCFSQuotaPeriod: 100ms
cpuManagerPolicy: none
cpuManagerReconcilePeriod: 10s
enableControllerAttachDetach: true
enableDebuggingHandlers: true
enforceNodeAllocatable:- pods
eventBurst: 10
eventRecordQPS: 5
evictionHard:
imagefs.available: 15%
memory.available: 100Mi
nodefs.available: 10%
nodefs.inodesFree: 5%
evictionPressureTransitionPeriod: 5m0s
failSwapOn: true
fileCheckFrequency: 20s
hairpinMode: promiscuous-bridge
healthzBindAddress: 127.0.0.1
healthzPort: 10248
httpCheckFrequency: 20s
imageGCHighThresholdPercent: 85
imageGCLowThresholdPercent: 80
imageMinimumGCAge: 2m0s
iptablesDropBit: 15
iptablesMasqueradeBit: 14
kind: KubeletConfiguration
kubeAPIBurst: 10
kubeAPIQPS: 5
makeIPTablesUtilChains: true
maxOpenFiles: 1000000
maxPods: 110
nodeLeaseDurationSeconds: 40
nodeStatusReportFrequency: 1m0s
nodeStatusUpdateFrequency: 10s
oomScoreAdj: -999
podPidsLimit: -1
port: 10250
registryBurst: 10
registryPullQPS: 5
resolvConf: /etc/resolv.conf
rotateCertificates: true
runtimeRequestTimeout: 2m0s
serializeImagePulls: true
staticPodPath: /etc/kubernetes/manifests
streamingConnectionIdleTimeout: 4h0m0s
syncFrequency: 1m0s
volumeStatsAggPeriod: 1m0s
``
解决方案
在不执行 kubeadm init 的情况下,您可以通过 /var/lib/kubelet/config.yaml 中 kubelet 配置文件中的 --pod-cidr 参数更改特定节点的 pod cidr。然后你可以通过 systemctl restart kubelet.service 重启 kubelet。
官方文档在这里
推荐阅读
- ssms - 修改 SQL Server Management Studio 中自动生成的脚本文件的默认文件名格式?
- git - 如何撤消 git stash save --keep-index
- python - 从列表内部分离字典值
- sass - 具有 px 和百分比单位的 SCSS min()
- flutter - 颤振,将“列表”转换为“字符串”时出错
- visual-studio-code - 使用 vscode 调试 rust 程序时发生错误(仅限 Windows)
- django - Google Cloud VideoIntelligence 语音转录 - 转录大小
- html - 如何将 Spring-MVC 连接到托管网站?
- makefile - 为什么`make`隐式规则“跨文件夹”不起作用?
- python - 在未知范围内找到数字的最快方法?