Kubernetes YAML 部署: 限制 CPU 和 内存 (0.5 核, 500MB) - test1 部署
以下是一个部署一个 Deployment 并限制 CPU 为 0.5 核和内存为 500MB 的示例 YAML 配置文件,该部署的名称为 'test1',副本数为 3,所在的 namespace 为 'test':
apiVersion: apps/v1
kind: Deployment
metadata:
name: test1
namespace: test
spec:
replicas: 3
selector:
matchLabels:
app: test1
template:
metadata:
labels:
app: test1
spec:
containers:
- name: test1
image: 'your-image-name'
resources:
limits:
cpu: '500m'
memory: '500Mi'
requests:
cpu: '500m'
memory: '500Mi'
请注意将 'your-image-name' 替换为您自己的镜像名称。
原文地址: https://www.cveoy.top/t/topic/piZq 著作权归作者所有。请勿转载和采集!