This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.16.4.5. 创建带有 Guaranteed 类 QoS 类的 pod
在创建带有 Guaranteed
类的 QoS 类的 pod 时请注意以下几点:
- pod 中的每个容器都必须具有内存限制和内存请求,且它们必须相同。
- pod 中的每个容器都必须具有 CPU 限制和 CPU 请求,且它们必须相同。
以下示例显示了一个容器的 pod 的配置文件。容器设置了内存限制和内存请求,均为 200 MiB。容器具有 CPU 限制和 CPU 请求,均为 1 CPU。
创建 pod:
oc apply -f qos-pod.yaml --namespace=qos-example
$ oc apply -f qos-pod.yaml --namespace=qos-example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 查看有关 pod 的详细信息:
oc get pod qos-demo --namespace=qos-example --output=yaml
$ oc get pod qos-demo --namespace=qos-example --output=yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
spec: containers: ... status: qosClass: Guaranteed
spec: containers: ... status: qosClass: Guaranteed
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意如果容器指定了自己的内存限值,但没有指定内存请求,OpenShift Container Platform 会自动分配与限制匹配的内存请求。同样,如果容器指定了自己的 CPU 限值,但没有指定 CPU 请求,OpenShift Container Platform 会自动分配与限制匹配的 CPU 请求。