1. 配置yaml
# cat nginx_limit.yaml apiVersion: v1 kind: Pod metadata: labels: app: nginx1 name: nginx1 namespace: test spec: containers: - image: nginx name: nginx1 resources: requests: cpu: "300m" memory: "56Mi" limits: cpu: "500m" memory: "128Mi"
2. 创建应用
# kubectl create -f nginx_limit.yaml pod/nginx1 created
3. 验证