开发者社区> 问答> 正文

我们如何在kubernetes worker节点中增加临时存储的大小

我们使用kubeadm(1个主节点4个工作节点)部署一个集群。

$ kubectl describe node worker1

Name:               worker1
Roles:              <none>
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/hostname=worker1
                    role=slave1
Annotations:        kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
                    node.alpha.kubernetes.io/ttl: 0
                    volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp:  Tue, 24 Sep 2019 14:15:42 +0330
Taints:             node.kubernetes.io/disk-pressure:NoSchedule
Unschedulable:      false
Conditions:
  Type                 Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message
  ----                 ------  -----------------                 ------------------                ------                       -------
  NetworkUnavailable   False   Tue, 24 Sep 2019 14:16:19 +0330   Tue, 24 Sep 2019 14:16:19 +0330   WeaveIsUp                    Weave pod has set this
  OutOfDisk            False   Mon, 07 Oct 2019 15:35:53 +0330   Sun, 06 Oct 2019 02:21:55 +0330   KubeletHasSufficientDisk     kubelet has sufficient disk space available
  MemoryPressure       False   Mon, 07 Oct 2019 15:35:53 +0330   Sun, 06 Oct 2019 02:21:55 +0330   KubeletHasSufficientMemory   kubelet has sufficient memory available
  DiskPressure         True    Mon, 07 Oct 2019 15:35:53 +0330   Mon, 07 Oct 2019 13:58:23 +0330   KubeletHasDiskPressure       kubelet has disk pressure
  PIDPressure          False   Mon, 07 Oct 2019 15:35:53 +0330   Tue, 24 Sep 2019 14:15:42 +0330   KubeletHasSufficientPID      kubelet has sufficient PID available
  Ready                True    Mon, 07 Oct 2019 15:35:53 +0330   Sun, 06 Oct 2019 02:21:55 +0330   KubeletReady                 kubelet is posting ready status. AppArmor enabled
Addresses:
  InternalIP:  192.168.88.206
  Hostname:    worker1
Capacity:
 attachable-volumes-azure-disk:  16
 cpu:                            4
 ephemeral-storage:              19525500Ki
 hugepages-1Gi:                  0
 hugepages-2Mi:                  0
 memory:                         16432464Ki
 pods:                           110
Allocatable:
 attachable-volumes-azure-disk:  16
 cpu:                            4
 ephemeral-storage:              17994700771
 hugepages-1Gi:                  0
 hugepages-2Mi:                  0
 memory:                         16330064Ki
 pods:                           110
System Info:
 Machine ID:                 2fc8f9eejgh5274kg1ab3f5b6570a8
 System UUID:                52454D5843-391B-5454-BC35-E0EC5454D19A
 Boot ID:                    5454514e-4e5f-4e46-af9b-2809f394e06f
 Kernel Version:             4.4.0-116-generic
 OS Image:                   Ubuntu 16.04.4 LTS
 Operating System:           linux
 Architecture:               amd64
 Container Runtime Version:  docker://17.3.2
 Kubelet Version:            v1.12.1
 Kube-Proxy Version:         v1.12.1
Non-terminated Pods:         (0 in total)
  Namespace                  Name    CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ---------                  ----    ------------  ----------  ---------------  -------------
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource                       Requests  Limits
  --------                       --------  ------
  cpu                            0 (0%)    0 (0%)
  memory                         0 (0%)    0 (0%)
  attachable-volumes-azure-disk  0         0
Events:
  Type     Reason                Age                     From                 Message
  ----     ------                ----                    ----                 -------
  Normal   Starting              45m                     kube-proxy, worker1  Starting kube-proxy.
  Normal   Starting              23m                     kube-proxy, worker1  Starting kube-proxy.
  Warning  EvictionThresholdMet  2m29s (x502 over 5d5h)  kubelet, worker1     Attempting to reclaim ephemeral-storage
  Normal   Starting              75s                     kube-proxy, worker1  Starting kube-proxy.

从对worker1的描述可以看出,存在磁盘压力(临时存储:19525500Ki)。我们将硬盘安装到/ dev / sdb1。

展开
收起
祖安文状元 2020-01-07 13:52:44 686 0
1 条回答
写回答
取消 提交回答
  • 不幸的是,(AFAIK)在您的节点上运行的kubelet并没有像其他应用程序(如Nginx)那样挂起和选择新配置的SIGHUP机制。简短的答案是,您将不得不重新启动kubelet。通常:

    $ systemctl restart kubelet
    
    

    如果您不希望在那里运行的应用程序受到影响,Kubernetes确实提供了一种机制:排水和警戒线。

    如果要自己关闭节点上的Pod,并注意什么时间什么时候关闭,等等,可以使用警戒线来防止在该节点上计划任何工作负载:

    $ kubectl cordon <nodename>
    
    

    如果您想让Kubernetes在该节点上驱逐Pod(以及使用警戒线将其设为不可调度):

    $ kubectl drain <nodename>
    
    

    关于排水的好处之一是它支持PodDisruptionBudget资源,使您可以安全地排水豆荚而不会影响正常运行时间(假设您已适当定义了豆荚破坏预算)

    2020-01-07 13:52:58
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
ACK 云原生弹性方案—云原生时代的加速器 立即下载
ACK集群类型选择最佳实践 立即下载
企业运维之云原生和Kubernetes 实战 立即下载

相关镜像