为什么 kubernetes minikube 限制全局 CPU 使用?
Why kubernetes minikube limits global CPU usage?
我在我的家用 PC 上安装了 minikube k8s(ubuntu20.04,amd 3950x,128gb RAM)。
capacity:
cpu: '32'
ephemeral-storage: 1967435760Ki
hugepages-1Gi: '0'
hugepages-2Mi: '0'
memory: 131897524Ki
pods: '110'
allocatable:
cpu: '32'
ephemeral-storage: 1967435760Ki
hugepages-1Gi: '0'
hugepages-2Mi: '0'
memory: 131897524Ki
pods: '110'
A 已经创建了 2 个部署和 3 个副本。每个 pod 可以使用 1 个核心 CPU。这是部署之一:
spec:
replicas: 3
selector:
matchLabels:
app: another-server
template:
metadata:
creationTimestamp: null
labels:
app: another-server
spec:
containers:
- name: server
image: 'server:v6'
resources:
limits:
cpu: '2'
requests:
cpu: '2'
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
所有 pods 的总 CPU 使用率始终限制为 2 CPU。似乎有某种全局设置可以限制 CPU 使用。
pc:~$ kubectl top pod
NAME CPU(cores) MEMORY(bytes)
another-server-5477557cd-7fmqh 301m 15Mi
another-server-5477557cd-ddcht 304m 16Mi
another-server-5477557cd-lp9vk 276m 15Mi
worker-6889bcc6f5-45zjt 332m 3Mi
worker-6889bcc6f5-b977s 326m 3Mi
worker-6889bcc6f5-s2rsc 326m 3Mi
是否可以开始多个 pods,每个 pod 有 1 CPU 个限制?
Minikube 作为 docker 容器启动,默认 cpu 限制 2。您应该使用新限制重新创建 minikube:
minikube stop
minikube delete
minikube start --cpus 16
我在我的家用 PC 上安装了 minikube k8s(ubuntu20.04,amd 3950x,128gb RAM)。
capacity:
cpu: '32'
ephemeral-storage: 1967435760Ki
hugepages-1Gi: '0'
hugepages-2Mi: '0'
memory: 131897524Ki
pods: '110'
allocatable:
cpu: '32'
ephemeral-storage: 1967435760Ki
hugepages-1Gi: '0'
hugepages-2Mi: '0'
memory: 131897524Ki
pods: '110'
A 已经创建了 2 个部署和 3 个副本。每个 pod 可以使用 1 个核心 CPU。这是部署之一:
spec:
replicas: 3
selector:
matchLabels:
app: another-server
template:
metadata:
creationTimestamp: null
labels:
app: another-server
spec:
containers:
- name: server
image: 'server:v6'
resources:
limits:
cpu: '2'
requests:
cpu: '2'
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
所有 pods 的总 CPU 使用率始终限制为 2 CPU。似乎有某种全局设置可以限制 CPU 使用。
pc:~$ kubectl top pod
NAME CPU(cores) MEMORY(bytes)
another-server-5477557cd-7fmqh 301m 15Mi
another-server-5477557cd-ddcht 304m 16Mi
another-server-5477557cd-lp9vk 276m 15Mi
worker-6889bcc6f5-45zjt 332m 3Mi
worker-6889bcc6f5-b977s 326m 3Mi
worker-6889bcc6f5-s2rsc 326m 3Mi
是否可以开始多个 pods,每个 pod 有 1 CPU 个限制?
Minikube 作为 docker 容器启动,默认 cpu 限制 2。您应该使用新限制重新创建 minikube:
minikube stop
minikube delete
minikube start --cpus 16