原硬件配置为 2H4G 升级为 4H8G
热加载后 系统已经生效
[root@k8s-node01 ~]# free -h
total used free shared buff/cache available
Mem: 7.5Gi 996Mi 6.5Gi 67Mi 346Mi 6.6Gi
Swap: 0B 0B 0B
[root@k8s-node01 ~]# lscpu | grep CPU
CPU op-mode(s): 32-bit, 64-bit
CPU(s): 4
On-line CPU(s) list: 0-3
Model name: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
BIOS Model name: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
CPU family: 6
NUMA node0 CPU(s): 0-3
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT Host state unknown
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT Host state unknown
但Kubernetes 不会自动生效
[root@harbor ~]# kubectl describe node k8s-node01
Name: k8s-node01
Roles: <none>
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/arch=amd64
kubernetes.io/hostname=k8s-node01
kubernetes.io/os=linux
node.kubernetes.io/node=
Annotations: management.cattle.io/pod-limits: {}
management.cattle.io/pod-requests: {"cpu":"250m","pods":"1"}
node.alpha.kubernetes.io/ttl: 0
projectcalico.org/IPv4Address: 192.168.77.94/24
projectcalico.org/IPv4IPIPTunnelAddr: 10.243.85.192
volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp: Tue, 12 Dec 2023 13:35:12 -0500
Taints: <none>
Unschedulable: false
Lease:
HolderIdentity: k8s-node01
AcquireTime: <unset>
RenewTime: Tue, 30 Jul 2024 12:15:26 -0400
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
NetworkUnavailable False Tue, 12 Mar 2024 17:01:23 -0400 Tue, 12 Mar 2024 17:01:23 -0400 CalicoIsUp Calico is running on this node
Addresses:
InternalIP: 192.168.77.94
Hostname: k8s-node01
Capacity:
cpu: 2
ephemeral-storage: 40383Mi
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 3703128Ki
pods: 110
Allocatable:
cpu: 2
ephemeral-storage: 38110180085
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 3600728Ki
pods: 110
System Info:
Machine ID: a9bd66d853144a08a6d71037ffebc3f3
System UUID: feb32f42-112b-1a87-5952-36ff542fc96a
Boot ID: d530df3e-e939-4eee-897a-147a6b86de5a
Kernel Version: 5.14.0-362.8.1.el9_3.x86_64
OS Image: Rocky Linux 9.3 (Blue Onyx)
Operating System: linux
Architecture: amd64
Container Runtime Version: containerd://1.6.21
Kubelet Version: v1.26.7
Kube-Proxy Version: v1.26.7
PodCIDR: 172.16.1.0/24
PodCIDRs: 172.16.1.0/24
Non-terminated Pods: (1 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits Age
--------- ---- ------------ ---------- --------------- ------------- ---
kube-system calico-node-b4wtl 250m (12%) 0 (0%) 0 (0%) 0 (0%) 212d
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
Resource Requests Limits
-------- -------- ------
cpu 250m (12%) 0 (0%)
memory 0 (0%) 0 (0%)
ephemeral-storage 0 (0%) 0 (0%)
hugepages-1Gi 0 (0%) 0 (0%)
hugepages-2Mi 0 (0%) 0 (0%)
Events: <none>
默认在运行 Kubernetes的虚拟机上热添加内存后,Kubernetes 本身并不会自动识别新添加的内存。你需要手动通知 Kubernetes 关于新增的内存。
需要做下一些步骤:
更新节点状态:首先,你需要打开虚拟机并手动刷新内存信息。在 Linux 系统中,你可以通过以下命令实现:
echo 1 > /proc/sys/vm/drop_caches
这个命令将释放所有空闲页面到内存中,并清除各级缓存。
重启 kubelet:其次,你需要重新启动在该节点上运行的 kubelet 服务以便其获取新的内存信息。kubelet 服务的重启过程取决于你的设置和使用的操作系统。如下是一个示例:
systemctl restart kubelet
确认节点内存:最后,你可以运行以下命令确认 Kubernetes 节点是否已经识别到新的内存:
kubectl describe node <node-name>
在 "Capacity" 或 "Allocatable" 部分,你应该能看到更新的内存数值。
[root@harbor ~]# kubectl describe node k8s-node01
...
Addresses:
InternalIP: 192.168.77.94
Hostname: k8s-node01
Capacity:
cpu: 4
ephemeral-storage: 40383Mi
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 7897432Ki
pods: 110
Allocatable:
cpu: 4
ephemeral-storage: 38110180085
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 7795032Ki
pods: 110