我是 Kubernetes 的新手,我正在玩 K3S。我正在通过打开部署中的副本来测试我的服务器的最大功率。在 150 时,我最弱的服务器达到了内存请求限制上限,无法为部署的 pod 分配更多内存,从而使它们处于“待定”状态。我看到节点显示“Ready,SchedulingDisabled”的状态,这一切都有意义。
我不明白的是为什么其他服务器不选择这些待处理的部署并将它们部署在那里?
# kubectl get nodes -A
NAME STATUS ROLES AGE VERSION
titan.zircon.local Ready master 3d23h v1.16.3-k3s.2
nexus.zircon.local Ready,SchedulingDisabled worker 2d21h v1.16.3-k3s.2
# kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
nexus.zircon.local 170m 2% 3008Mi 25%
titan.zircon.local 316m 0% 2313Mi 1%
default fedora-7c586469b4-ldq8l 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-sbzph 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-74mmh 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-ldq8l 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-k4669 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-6gg2c 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-sbzph 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-74mmh 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-k4669 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-6gg2c 0/1 Pending 0 0s <none> <none> <none> <none>
default fedora-7c586469b4-94tx6 0/1 Pending 0 7m43s <none> <none> <none> <none>
default fedora-7c586469b4-k8bdl 0/1 Pending 0 7m43s <none> <none> <none> <none>
default fedora-7c586469b4-8d64k 0/1 Pending 0 7m43s <none> <none> <none> <none>
default fedora-7c586469b4-ldq8l 0/1 Pending 0 2m59s <none> <none> <none> <none>
default fedora-7c586469b4-sbzph 0/1 Pending 0 2m59s <none> <none> <none> <none>
default fedora-7c586469b4-74mmh 0/1 Pending 0 2m59s <none> <none> <none> <none>
default fedora-7c586469b4-k4669 0/1 Pending 0 2m59s <none> <none> <none> <none>
default fedora-7c586469b4-6gg2c 0/1 Pending 0 2m59s <none> <none> <none> <none>
这是部署配置:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"labels":{"app":"fedora"},"name":"fedora","namespace":"default"},"spec":{"replicas":1,"selector":{"matchLabels
creationTimestamp: "2019-12-23T21:38:15Z"
generation: 7
labels:
app: fedora
name: fedora
namespace: default
resourceVersion: "281186"
selfLink: /apis/apps/v1/namespaces/default/deployments/fedora
uid: 729b502f-6b4e-4a44-b870-e0d6e6b9929e
spec:
progressDeadlineSeconds: 600
replicas: 155
revisionHistoryLimit: 10
selector:
matchLabels:
app: fedora
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
app: fedora
spec:
containers:
- args:
- -c
- while true; do echo hello; sleep 10;done
command:
- /bin/sh
image: docker.io/fedora:latest
imagePullPolicy: Always
name: fedora
resources:
limits:
cpu: 80m
memory: 256Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status:
availableReplicas: 147
conditions:
- lastTransitionTime: "2019-12-23T21:38:15Z"
lastUpdateTime: "2019-12-23T21:38:46Z"
message: ReplicaSet "fedora-7c586469b4" has successfully progressed.
reason: NewReplicaSetAvailable
status: "True"
type: Progressing
- lastTransitionTime: "2019-12-27T19:48:41Z"
lastUpdateTime: "2019-12-27T19:48:41Z"
message: Deployment has minimum availability.
reason: MinimumReplicasAvailable
status: "True"
type: Available
observedGeneration: 7
readyReplicas: 147
replicas: 155
unavailableReplicas: 8
updatedReplicas: 155